Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Date Question


Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2003, 04:56 PM
geek's Avatar
geek geek is offline
Regular
 
Join Date: Sep 2002
Posts: 78
Question Date Question


Hey,

I have a question for you guys and hopefully someone will be able to help. What I want to do is display the date e.g "Sunday 30 March, 2003" and maybe the time too if possible in a text box "TxtDate".

I've also got a calander on my form and I was wondering how to keep a running date...that is how to get the date to change everyday etc...any help would be great

thanks in advance
Reply With Quote
  #2  
Old 03-29-2003, 05:03 PM
starbitz's Avatar
starbitz starbitz is offline
Junior Contributor
 
Join Date: Feb 2003
Location: Philippines
Posts: 336
Default

Quote:
Originally Posted by geek
Hey,

I have a question for you guys and hopefully someone will be able to help. What I want to do is display the date e.g "Sunday 30 March, 2003" and maybe the time too if possible in a text box "TxtDate".

I've also got a calander on my form and I was wondering how to keep a running date...that is how to get the date to change everyday etc...any help would be great

thanks in advance



try txtDate.text = Now()
Reply With Quote
  #3  
Old 03-29-2003, 05:05 PM
Kaluriel's Avatar
Kaluriel Kaluriel is offline
Senior Contributor
 
Join Date: Jun 2002
Location: Where Heaven & Hell meet
Posts: 813
Default

Format(Now(),"dddd dd mmmm, yyyy")
__________________
"They say the the world will end in the same way it was created. I disagree, I think it'll end without the internet" ~ Kaluriel 2001
"The edit button is mightier than the doublepost" ~ Kaluriel 2003
Reply With Quote
  #4  
Old 03-29-2003, 05:07 PM
geek's Avatar
geek geek is offline
Regular
 
Join Date: Sep 2002
Posts: 78
Default

I tried that but it doesn't seem to work *shrugs*
Reply With Quote
  #5  
Old 03-29-2003, 05:09 PM
Kaluriel's Avatar
Kaluriel Kaluriel is offline
Senior Contributor
 
Join Date: Jun 2002
Location: Where Heaven & Hell meet
Posts: 813
Default

mine or starbitz?
__________________
"They say the the world will end in the same way it was created. I disagree, I think it'll end without the internet" ~ Kaluriel 2001
"The edit button is mightier than the doublepost" ~ Kaluriel 2003
Reply With Quote
  #6  
Old 03-29-2003, 05:12 PM
geek's Avatar
geek geek is offline
Regular
 
Join Date: Sep 2002
Posts: 78
Default

neither...what should I have as the Private Sub TxtDate_"" () if that even makes sense....I'm not really good with this sort of thing...hehe
Reply With Quote
  #7  
Old 03-29-2003, 05:17 PM
Kaluriel's Avatar
Kaluriel Kaluriel is offline
Senior Contributor
 
Join Date: Jun 2002
Location: Where Heaven & Hell meet
Posts: 813
Default

Have a timer on the form, and put this in the code. Set the interval at 1000 and enabled = true, that should update every second
Code:
Private Sub Timer1_Timer() txtData.Text = Format(Now(),"dddd dd mmmm, yyyy" ) End Sub
__________________
"They say the the world will end in the same way it was created. I disagree, I think it'll end without the internet" ~ Kaluriel 2001
"The edit button is mightier than the doublepost" ~ Kaluriel 2003
Reply With Quote
  #8  
Old 03-29-2003, 05:18 PM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,594
Default

Quote:
Originally Posted by geek
neither...what should I have as the Private Sub TxtDate_"" () if that even makes sense....I'm not really good with this sort of thing...hehe



i'd say put this it in a timer
__________________
"That which seems simple is often overlooked" ~ me
Halloween Special FX
Web Hosting from Spook Technologies
Reply With Quote
  #9  
Old 03-29-2003, 05:23 PM
geek's Avatar
geek geek is offline
Regular
 
Join Date: Sep 2002
Posts: 78
Default

I did that and I got a run-time error '424' - object required....
Reply With Quote
  #10  
Old 03-29-2003, 05:24 PM
starbitz's Avatar
starbitz starbitz is offline
Junior Contributor
 
Join Date: Feb 2003
Location: Philippines
Posts: 336
Default

Quote:
Originally Posted by geek
neither...what should I have as the Private Sub TxtDate_"" () if that even makes sense....I'm not really good with this sort of thing...hehe



Try this one:


txtDate.text = FormatDateTime(Now(),vbLongDate) & " " & FormatDateTime(Now(),vbLongTime)

it should work.
Note that txtDate is a textbox
Reply With Quote
  #11  
Old 03-29-2003, 05:27 PM
Iceplug's Avatar
Iceplug Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: California, USA
Posts: 16,583
Default

Quote:
Originally Posted by geek
I did that and I got a run-time error '424' - object required....


What line do you get run-time error 424 on?
Make sure that you changed the name to the control that you have on your form.
i.e.
Text1.Text if your TextBox's name is Text1.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #12  
Old 03-29-2003, 05:28 PM
geek's Avatar
geek geek is offline
Regular
 
Join Date: Sep 2002
Posts: 78
Default

Wow...thanks soooo much it works.... you're a legend!! Thanks everyone for your help and your patience...hehe...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
date picker question mlarrea General 2 02-28-2002 02:38 PM
comparing dates with visual foxpro and ado azwaan General 8 01-08-2002 05:50 AM
question on date format arrowman1 Database and Reporting 9 11-29-2001 08:11 PM
Date question Kolah General 1 11-14-2001 02:58 PM
Date question Atimos289 General 3 05-22-2001 09:35 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->