473,614 Members | 2,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date and Time in VB6 Form

Mohan Krishna
115 New Member
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 5100
lotus18
866 Contributor
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 New Member
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 New Member
No delay for me, I've tried it.
Nov 19 '07 #4
lotus18
866 Contributor
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 New Member
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 Recognized Expert Expert
...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 New Member
Thank You AHMEDYO and KILLER42 !

It worked by calling the timer function in form load.

ThanQ!
Nov 20 '07 #8
Killer42
8,435 Recognized Expert Expert
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
1922
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" size="20"><br> 90 days from date</p> <p><input type="submit" value="Submit" name="B1"></p>
1
2092
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 seconds 'cause I set them to 0. I need to be able to save them in the database (Access) where the format of the field is for example: 12/22/2004 14:08:00 Now, I do have already code that does that but my supervisor doesn't like it because it's...
9
2540
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 time using date() and time() JavaScript commands, but can't find the right syntax to put them in the input command, example: <input name=date value="<javascript command here">
8
25378
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" size=3> Month: <input name="m1" alt="Month" size=3> Year: <input name="y1" alt="Year" size=5> (4 digits for year, e.g.
11
4638
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 having a heck of a time doing so. I have created a form where I use drop downs do specify year, month, date, hour, minute and seconds. When the form is loaded, the dropdowns have to display the proper values for the current time zone type. This
3
7453
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 report prints dental and hygenist appointments for the date (one subreport for each). The user wants to enter a date range and have one page for each date in the date range. I'm wondering how to modify the report. The only way I see is to create...
3
3288
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 the field should only be showing one or the other (date or time). Even on the back end of the database where the column properties are, I have chosen the smallest date/time formats. When the aspx page runs, it shows the date and time (ie:in a...
0
2836
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 control's value is always 12:00:00 am instead of the date i selected even though the date displays correctly on the date and time picker control. the controls are unbound. why is this? i also have another identical form where the date and...
1
2083
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 date/time stamp when a user enters a record. So, the popup form is only necessary when a user needs to change the date/time. To make this more user-friendly...there will be times when a user will be away from the computer, and therefore, will have to...
14
1899
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 local use Date/Time. Thanks, Miguel
0
8198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8294
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2575
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.