Current Date in a Text Box

  • Thread starter Thread starter Haf-A-Mil
  • Start date Start date
H

Haf-A-Mil

Hello all Im new to this community and VB sort of. The question I do have
that someone here can hopefully help me out with is, Im designing an app for
a Windows CE device and Im having trouble displaying the current date on a
form in a textbox. I looked around online and found some tips but none really
worked. I know when I was designing stuff for ASP.NET you had to make sure
you put this stuff in the page_load, I know its a little different with CE. I
have some code on a button click to display the current date in a textbox but
I want to have a textbox that displays the current date on a form after
logging into the app WITHOUT a button click. Is there anything I need to put
in an onload? Or is it just as simple as:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim thisDate As Date
thisDate = Today

Haven't been able to get this to work, but hopefully someone will be able to
help a VB newbie, thanks!
 
Try adding a timer object to your form and setting the timeout to something
like 1000 (1 second), or more. Set Enable to true and create a Tick event
handler. In the event handler, do whatever you want to do every 1 second
(or whatever you set the time-out for), like setting label1.Text =
DateTime.Now.ToString() or something.

Paul T.
 
Paul,

Thanks so much, I've be toying around with so many different ways but this
worked straight off the bat, thank u soooooooooooooooooooo much!!
 
Back
Top