Putting date and time in text box ...Should be simple 
Author Message
 Putting date and time in text box ...Should be simple

What is the syntax to put the current date or any date in the text
property of a text box.  I can do this with code but can not get the
correct syntax to add it in the properties window.  I have tried =Date()
etc but this does not work. TY.
                                John



Thu, 16 Nov 2000 03:00:00 GMT  
 Putting date and time in text box ...Should be simple

Try setting the property to:
=Format(Now(), mm/dd/yy  hh:mm)



Fri, 17 Nov 2000 03:00:00 GMT  
 Putting date and time in text box ...Should be simple

Or simpler yet:
TextBox1.Text = Now

That does the same thing :))


Quote:
>Try setting the property to:
>=Format(Now(), mm/dd/yy  hh:mm)



Fri, 17 Nov 2000 03:00:00 GMT  
 Putting date and time in text box ...Should be simple

Ruben,

Using Now (by itself) you have no guarantee of the format of the output.
For example, you will find that if the program is run at midnight, the time
won't be displayed.

If you EVER want to format output in VB in a certain way, you must use the
Format command.

Matthew



Quote:
> Or simpler yet:
> TextBox1.Text = Now

> That does the same thing :))



> >Try setting the property to:
> >=Format(Now(), mm/dd/yy  hh:mm)



Fri, 17 Nov 2000 03:00:00 GMT  
 Putting date and time in text box ...Should be simple

On Sun, 31 May 1998 22:17:42 -0400, "John F. Reilly"

Quote:

>What is the syntax to put the current date or any date in the text
>property of a text box.  I can do this with code but can not get the
>correct syntax to add it in the properties window.  I have tried =Date()
>etc but this does not work. TY.
>                                John

text1.text=format$(Now$,"long date") or some other named format...check the
help file

eggers ONE at TSIL dot NET



Sat, 18 Nov 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Format date/time in DTPicker to display AM/PM or 24 hour time

2. DATE/TIME linked to Text Box

3. Putting a value from a combo box into a text box on a form

4. Put text inside a circle in a Rich Text Box

5. Putting Text into a text box

6. vb4: put tab chr(9) in label.caption or text box.text

7. Compare date in form with date/time in form with date/time in database

8. Put Date/Time on Right Side of Form.Caption

9. A simple (?) Date/Time problem

10. Hopefully Simple Date/Time field question

11. Simple Date & Time Help Please

12. VB5, How to put text in the systemtray (like the time)

 

 
Powered by phpBB® Forum Software