. Net timer usage (timeofday)

Source: Internet
Author: User
Private sub timereffectick (byval sender as system. Object, byval e as system. eventargs) handles timer1.tick
Dim SQL as string
Dim dT as new datatable
Time2 = "11:14:00" ': Set the scheduled time in the 24-hour format and place it in the loading program.
Timer1.interval = 1000 'sets the timer to run once every second, which should be placed in the loading program

Timer1.enabled = true' the timer starts to run and should be placed in the loading program due to an accident

Time1 = timeofday () 'Get the current time
Rownum. Text = time1
If time1 = time2 then
Dim age
If agetext. Text = "" then
Age = 0
Else
Age = Val (agetext. Text)
End if
SQL = "select * from student where Sid = '" & xuehaotext. Text &"'"
Conn = connect_db ()
Rs = new sqldataadapter (SQL, Conn)
'Conn. Close ()
Rs. Fill (DT) 'Fill table
Datagridview1.datasource = DT ': displays the data in the table in the datagridview control and binds the data.
Datagridview1.columns (0). headertext = "student ID" 'sets the column name.
Datagridview1.columns (1). headertext = "name"
Datagridview1.columns (2). headertext = "Age"
Datagridview1.columns (3). headertext = "score"
Rownum. Text = STR (datagridview1.rowcount )'
Xuehaotext. Text = maid (0). cells (0). Value 'Get a value in the dview
Nametext. Text = maid (0). cells (1). Value
If (maid (0). cells (2). value = 0) then
Agetext. Text = ""
Else
Agetext. Text = STR (maid (0). cells (2). value)
End if
If (maid (0). cells (3). value = 0) then
Scoretext. Text = ""
Else
Scoretext. Text = STR (maid (0). cells (3). value)
End if
End if
End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.