Capturing Date and Time

linusfishing

Member
Joined
Jun 6, 2005
Messages
15
Programming Experience
Beginner
Hello,

I would like to know the codes in vb.net to capture the date and time in the computer. I doubt using the datetimepicker is the right way, because i want it to appear as a label beside the client's name. I need to apply it in my chat application project. Help is much appreciated. :)

Linus
 
Me.Label1.Text = Date.Now 'get the current date and time


if you want to have something like clock you should use a timer control ... just draw a timer control and add this code:

VB.NET:
[color=blue]Private Sub[/color] Timer1_Tick([color=blue]ByVal[/color] sender [color=blue]As[/color] System.Object, [color=blue]ByVal[/color] e [color=blue]As[/color] System.EventArgs) [color=blue]Handles[/color] Timer1.Tick
  
[color=blue]Me[/color].Label1.Text = TimeString
[size=2] 
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub[/color][color=#000000]
[/color][/size]

Cheers ;)
 
Back
Top