|
-
May 13th, 2003, 02:28 AM
#1
Thread Starter
Member
how do u convert this VB code to VB.net
Public Timer_time()
label1.capion = TIME
end if
As everyone told me the above code will show me time every sec
if i set the timer object to 1000 intervel
now the problem is that there no caption in .net labels
so i think captions mean TEXT in .net term
e.g labels.text = time
But then TIME is not in VB.net too >.< so how to i set it so i can show the time in the background so that i see the current time every sec and still cont. with my programs
-
May 13th, 2003, 02:44 AM
#2
Yes most caption properties are now text properties. To get the time check out the shared methods of the DateTime type. Something like DateTime.Now.ToString or DateTime.Now.ToShortTimeString there are several ways to display the time in different formats.
-
May 13th, 2003, 02:54 AM
#3
Thread Starter
Member
so if i wanted that time to runs in the background of the .net form
will that updates every sec ?? or will it just show the time
at the instance where i call it ??
cos i have been looking on help posting on forum for over 5 hour now and i'm kind of getting frustrated to get the answers quickly >.<
Vb.net help sucks in VS.net pro version
-
May 13th, 2003, 04:56 AM
#4
Frenzied Member
I guess you have to add a timer (Timer1) to your form and set its interval property to 1000, then start it when you need for example in form load event. Then write your code like this:
VB Code:
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.Label1.Text = DateTime.Now.ToLongTimeString
End Sub
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
May 13th, 2003, 05:14 AM
#5
Thread Starter
Member
Thks alots ^^ u really save my ass searching >.<
i have been search and looking the help thing in VB.net >.<
it too complicated, but now i know what to do it very easy ^^
thks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|