Guys, will some send me some hints on how to display a time and date in my form... the basic one because im just starting to learn VB!
Show date and time on form
Collapse
X
-
Tags: None
-
Can you just give us a few more details? Like, do you just want to put the date and time once in a text box, or print it onto the form? Or do you want it in a "status bar" type thing at the bottom, constantly updated, or what? (It's not as hard as it sounds - there's a control which provides this more or less automatically).Originally posted by variouz3ckzGuys, will some send me some hints on how to display a time and date in my form... the basic one because im just starting to learn VB!
And what version of VB are you using? -
ei Killer42, thanks for the response, i am using a VB6 version i need to display it in a text box, or maybe its kind of you to show me the codes in "status bar" thing type... well is it hard to study vb6?! well give me some advice and guidelines to understand it gradually... hoping for ASAP response...Originally posted by Killer42Can you just give us a few more details? Like, do you just want to put the date and time once in a text box, or print it onto the form? Or do you want it in a "status bar" type thing at the bottom, constantly updated, or what? (It's not as hard as it sounds - there's a control which provides this more or less automatically).
And what version of VB are you using?Comment
-
Hi variouz3ckz -
When you use textbox, try this
for date:
<OBJECT NAME>.text = format(now,"mm/dd/yyyy")
example: txtDate.text = format(now,"mm/dd/yyyy")
for time which will dynamically change every second.
Step 1. Put Timer object into your form.
Step 2. Set its "Interval" property to 1000.
Step 3. Double-click on the Timer control.
Note: There must be function created for Private Sub Timer_.... and End Sub
Step 4. Between Private Sub and End Sub, put this code below
txtTimer.text = format(now,"mm: hh:ss AM/PM")
txtTimer must be the name of the textbox you want the time to put into.
If you want to use the Status Bar object, much easier, just add panels and set panel "Style" property to 5 - sbrTime or 6 - sbrDate.
Hint: Select status bar object, in the Properties window click on "(Custom)" and the "Property Pages" form will pop up. Click on "Panels" tab and you will find the "Style" dropdown box.
Hope this would help you.
Have a nice day!Comment
-
Note, to use the StatusBar control you have to go to "Project | Components" and select "Microsoft Windows Common Controls" (the version number will probably be 5 or 6). This will add the StatusBar control (as well as a few others) to your toolbox.Comment
-
ei fplesco... the information you gave me was good.. but the time and date doesnt automatically appear in the form as i play it. i need to press any key, to make the appearance in the textbox.Originally posted by fplescoHi variouz3ckz -
When you use textbox, try this
for date:
<OBJECT NAME>.text = format(now,"mm/dd/yyyy")
example: txtDate.text = format(now,"mm/dd/yyyy")
for time which will dynamically change every second.
Step 1. Put Timer object into your form.
Step 2. Set its "Interval" property to 1000.
Step 3. Double-click on the Timer control.
Note: There must be function created for Private Sub Timer_.... and End Sub
Step 4. Between Private Sub and End Sub, put this code below
txtTimer.text = format(now,"mm: hh:ss AM/PM")
txtTimer must be the name of the textbox you want the time to put into.
If you want to use the Status Bar object, much easier, just add panels and set panel "Style" property to 5 - sbrTime or 6 - sbrDate.
Hint: Select status bar object, in the Properties window click on "(Custom)" and the "Property Pages" form will pop up. Click on "Panels" tab and you will find the "Style" dropdown box.
Hope this would help you.
Have a nice day!
tnx for helpin'
have a nice day...Comment
-
try putting the code given to you under Private Sub Form_Load()Comment
Comment