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!
7 7410
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?
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...
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!
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.
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...
@variouz3ckz
try putting the code given to you under Private Sub Form_Load()
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. :)
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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"...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
| |