PC Review


Reply
Thread Tools Rate Thread

Current Date in a Text Box

 
 
Haf-A-Mil
Guest
Posts: n/a
 
      5th Mar 2009
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!
 
Reply With Quote
 
 
 
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      6th Mar 2009
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.

"Haf-A-Mil" <(E-Mail Removed)> wrote in message
news:904080AF-2911-47D4-8C67-(E-Mail Removed)...
> 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!



 
Reply With Quote
 
Haf-A-Mil
Guest
Posts: n/a
 
      6th Mar 2009
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!!

"Paul G. Tobey [eMVP]" wrote:

> 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.
>
> "Haf-A-Mil" <(E-Mail Removed)> wrote in message
> news:904080AF-2911-47D4-8C67-(E-Mail Removed)...
> > 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!

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set XML text box value to current date & time andyoye Microsoft C# .NET 1 10th Oct 2008 04:48 PM
Export text with current date Senthil Microsoft Access Queries 1 25th Dec 2007 08:45 AM
Use Current Date on text file Sammy via AccessMonster.com Microsoft Access Form Coding 2 3rd May 2007 02:47 PM
Can I display the current date in a text box? =?Utf-8?B?c3RlcGhpZWJyYWR5?= Microsoft Excel Misc 2 2nd Dec 2005 02:45 PM
current date in text field of an input box tte Microsoft Excel Misc 1 4th Nov 2003 07:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:47 AM.