Home > Software engineering >  Vb specified time
Vb specified time

Time:10-13

How to specify a time to perform a job with the if... then

CodePudding user response:

Put a timer and set the Enabled=true, the Interval for a non-zero number,
Write the following code:
 Private b As Boolean 
Private Sub Timer1_Timer ()
If Now & gt; A certain time And Not (b) Then
B=True 'did not do
To do STH.
End the If
End Sub

CodePudding user response:

What is the time format (to add date

CodePudding user response:

Time=# 1/30/2014 14:07 PM#

CodePudding user response:

Reference in the MSDN:
CDate function example
This example USES the CDate function to convert a string to Date, generally speaking, a hard-coded string format of the Date and time (as shown in the example) is not good, a better approach is to use the Date of the original meaning expression and time of the original meaning expression (such as # 2/12/1969 #, # 4:45:23 PM#),

 Dim MyDate MyShortDate, MyTime, MyShortTime 
MyDate="February 12, 1969" 'definition dates,
MyShortDate=CDate (MyDate) 'into the Date data type,

MyTime="4:35:47 PM" 'definition of time,
MyShortTime=CDate (MyTime) 'into the Date data type,

CodePudding user response:

why not, how should manage

CodePudding user response:

reference 5 floor u013568161 reply:
like this, why not should how

Remove the quotes,

CodePudding user response:

CodePudding user response:

A comma instead of half Angle,
,
=& gt;
.

CodePudding user response:

If Now ()=Format (CDate (" the 2014-01-07 16:32:00 "), "yyyy - mm - dd hh: mm: ss") Then image2. Visible=True
How many seconds can be timed to the specific

CodePudding user response:

Actually don't need to bother, comparing string,
Set a Timer control, once per second,
 
If Now="2014/2/3 21:31:40 Monday" Then
MsgBox "ASd
"End the If

CodePudding user response:

 
StrDate="2014-2-6 22:58:40 afternoon"
If DateDiff (" s ", CDate (Format (strDate, "yyyy - - dd Hh: mm Nn: Ss")), Now) & gt;=0 Then
MsgBox "time to"
End the If

CodePudding user response:

Compare the date time text can cough up not so complicated

CodePudding user response:

Clock, second judgment...

CodePudding user response:

 If Now & gt;="2014-01-30 ticket" Then 
Image2. Visible=True
Form2. Show
End the If
  • Related