473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Show date and time on form

variouz3ckz
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!
Jul 25 '07 #1
7 7410
Killer42
8,435 Expert 8TB
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!
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).

And what version of VB are you using?
Jul 26 '07 #2
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).

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...
Jul 27 '07 #3
fplesco
82
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!
Jul 27 '07 #4
Killer42
8,435 Expert 8TB
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.
Jul 27 '07 #5
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!
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.

tnx for helpin'
have a nice day...
Jul 27 '07 #6
@variouz3ckz
try putting the code given to you under Private Sub Form_Load()
Jan 14 '12 #7
Killer42
8,435 Expert 8TB
Thanks cloud24, that's good advice.

It may, however, be a little late for variouz3ckz, since his/her question was posted about 4½ years ago. :)
Jan 17 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
9
by: Shaiboy_UK | last post by:
Hi all, Hopefully something simple here. I have written a form that takes data from a text box and updates it into an Access database. However, I want to also pass the local user date and...
8
by: dlx_son | last post by:
Here is the code so far <form name="thisform"> <h3>Enter time to add to or subtract from:</h3> (If not entered, current time will be used)<br> Day: <input name="d1" alt="Day of month"...
15
by: Paul T. Rong | last post by:
Hi everybody, This time a very very difficult case: I have a table "tblStudent", there are 50 students, I also made a form "frmStudent" based on "tblStudent", now if I don't want to show all...
5
by: M Skabialka | last post by:
I am creating my first Visual Studio project, an inventory database. I have created a form and used written directions to add data from a table to the form using table adapters, data sets, etc. ...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
6
by: nairda | last post by:
Hi all, I'm making a sales report form that linked to my sales database (sales.mdb). I want to show the sales report in a MSHFlexgrid sorted by a period of time. I have these 2 combo boxes (Each...
8
by: zufie | last post by:
Hi, I created some forms using the "Create form using Wizard". However, I cannot view the forms I created with Wizard unless I click on the Design View icon. I checked the forms' properties...
1
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.