473,396 Members | 1,671 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,396 software developers and data experts.

Date and Time in VB6 Form

Mohan Krishna
115 100+
Hi everyone

I use the following code in VB 6 Form (Timer function) to show the date and time in textboxes.
My question is when the form is loaded, the textbox doesn't show the time immediately but takes some delay.

Why so? How can we reduce that delay?

Expand|Select|Wrap|Line Numbers
  1.     'txtLoginDt = Date
  2.     txtLoginDt = Format(Date, "ddd, mmm dd, yyyy")
  3.     'txtLoginTm = Time
  4.     txtLoginTm = Format(Time, "hh:mm:ss Am/PM")
  5.  
Nov 19 '07 #1
8 5038
lotus18
866 512MB
Hi everyone

I use the following code in VB 6 Form (Timer function) to show the date and time in textboxes.
My question is when the form is loaded, the textbox doesn't show the time immediately but takes some delay.

Why so? How can we reduce that delay?

Expand|Select|Wrap|Line Numbers
  1.     'txtLoginDt = Date
  2.     txtLoginDt = Format(Date, "ddd, mmm dd, yyyy")
  3.     'txtLoginTm = Time
  4.     txtLoginTm = Format(Time, "hh:mm:ss Am/PM")
  5.  
Can explain us in more details. Did you used 2 different timer for the time and date? Their intervals? Does interval is set to 1000?
Nov 19 '07 #2
Mohan Krishna
115 100+
Can explain us in more details. Did you used 2 different timer for the time and date? Their intervals? Does interval is set to 1000?
Hi,
Thanks for response!
Yes, I am using one timer and the interval is set to 1000.
Nov 19 '07 #3
keign
8
No delay for me, I've tried it.
Nov 19 '07 #4
lotus18
866 512MB
Hi,
Thanks for response!
Yes, I am using one timer and the interval is set to 1000.
I'm not sure by this. Try to set your interval to 1.

Hope it helps
Nov 19 '07 #5
AHMEDYO
112 100+
HI...

thats must be, because the interval must expired then timer code will be executed, you can call timer sub 1 time in your form load

for example

Expand|Select|Wrap|Line Numbers
  1.  Call Timer1_Timer()
GOOD LUCK
Nov 19 '07 #6
Killer42
8,435 Expert 8TB
...Try to set your interval to 1.
I like AHMEDYO's response. But I wouldn't recommend setting the timer interval to 1. You will be trying to update the date and time 1000 times per second. This is likely to slow down other operations.
Nov 20 '07 #7
Mohan Krishna
115 100+
Thank You AHMEDYO and KILLER42 !

It worked by calling the timer function in form load.

ThanQ!
Nov 20 '07 #8
Killer42
8,435 Expert 8TB
Thank You AHMEDYO and KILLER42 !

It worked by calling the timer function in form load.
Excellent! Glad to hear you've got it sorted.

(Note, lotus18's suggestion was quite valid, too. Although I pointed out a potential problem, it can be easily prevented.)
Nov 20 '07 #9

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

Similar topics

21
by: Samir | last post by:
Say I put a date and time for like this: Jun-15-04 21:52:06 Here is the form I am using: <form> <p><input type="text" name="T1" size="20"><br> date</p> <p><input type="text" name="T2"...
1
by: simina | last post by:
Hi... I have an "appointments" page where the user should (or not necessarily) choose a date and time for his appointment, from 6 combo boxes:year, month, day, hour, minute and AM or PM, without...
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"...
11
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
3
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
0
by: fredloh | last post by:
i have a tab control on my form. i then have several microsoft date and time picker control on the tab control. when i select a date on any of the date and time picker control, the result of the...
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...
14
by: shapper | last post by:
Hello, Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC? I want to store Date/Time in UTC in the database but display it in...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.