我想在计时器达到50时运行特定功能,此时将显示一个消息框,然后运行特定功能,然后将其重置为0。您能否帮助查看并添加可能对我有帮助的代码? / p>
注意:label1.text是计时器显示的地方
感谢您的帮助。
提前谢谢
MessageBox.Show("Please wait were updating the data table..")
Timer1.Stop()
Dim sqlquery As String = "SELECT PT_N_Std_Tuning, PT_TimeIn, PT_TimeOut, Variant FROM tbl_V9_Datalog WHERE Variant = '5' AND dateadd(hour, -1, dateadd(hour,datediff(hour,0,getdate()),0)) <= [PT_TimeIn]
and PT_TimeIn < dateadd(hour,datediff(hour,0,getdate()),0) ORDER BY PT_TimeIn ASC"
Dim reader As SqlDataReader
Dim adapter As New SqlDataAdapter
Dim command As New SqlCommand
command.CommandText = sqlquery
command.Connection = conn1
adapter.SelectCommand = command
'command.Parameters.Add("@variantno", SqlDbType.VarChar).Value = cmbox_variant.Text
reader = command.ExecuteReader
Dim DataTableName As String = textbox1.text
Dim dValue As Double
Dim ID1 As String = ""
Dim ID2 As String = ""
Dim ID3 As String = ""
Dim ID4 As String = ""
Dim ID5 As String = ""
Dim ID6 As String = ""
Dim ID7 As String = ""
Dim ID8 As String = ""
Dim ID9 As String = ""
Dim ID10 As String = ""
Dim ID11 As String = ""
Dim ID12 As String = ""
Dim Note1 As String = ""
Dim Note2 As String = ""
Dim sDate As String = ""
Dim sTime As String = ""
Dim wd As Int32 = S2K_SetDataTableVariableValue(DataTableName, dValue, ID1, ID2, ID3, ID4, ID5, ID6, ID7, ID8, ID9, ID10, ID11, ID12, Note1, Note2, sDate, sTime)
Try
If reader.HasRows Then
While reader.Read()
dValue = (Val(reader.Item("PT_N_Std_Tuning").ToString))
DataTableName = TextBox1.Text
ID1 = reader.Item("PT_TimeIn").ToString
ID2 = ""
ID3 = ""
ID4 = ""
ID5 = ""
ID6 = ""
ID7 = ""
ID8 = ""
ID9 = ""
ID10 = ""
ID11 = ""
ID12 = ""
Note1 = "" 'reader.Item("AttemptNo").ToString
Note2 = ""
Dim sDate1 = reader.GetOrdinal("PT_TimeOut")
sDate = reader.GetDateTime(sDate1).ToShortDateString
Dim sTime1 = reader.GetOrdinal("PT_TimeOut")
sTime = reader.GetDateTime(sTime1).ToLongTimeString
wd = S2K_SetDataTableVariableValue(DataTableName, dValue, ID1, ID2, ID3, ID4, ID5, ID6, ID7, ID8, ID9, ID10, ID11, ID12, Note1, Note2, sDate, sTime)
End While
MessageBox.Show("Data has been updated")
End If
End If
没有消息框显示标签不断打勾的标签达到50个