 |
| VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 29th, 2007, 03:20 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Insert System date and System Time -Form _TextBox
ANY BODY HELP ME!!!!!!
I HAVE A PROJECT AND IN A FORM I HAVE THREE TEXT BOXES.ONE FOR THE CUSTOMER NUMBER,ANOTHER FOR DATE,TIME.CUSTOMER NUMBER WILL BE INSERTED AUTOMATICALLY.BUT I WANT THE DATE AND TIME TO BE THAT OF THE SYSTEM DATE AND TIME.WHAT CODE SHOULD I USE IT TO ACCOMPLISH IT?
THIS PROJECT IS AN URGENT ONE.SO I HAVE TO COMPLETE IT TODAY ITSELF.SO,PLEASE HELP ME URGENTLY........
NANDA KUMAR
[email protected]
|
|

January 29th, 2007, 04:25 AM
|
|
Registered User
|
|
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
you could try Date & Time. do you have the code that inserts customer nu mber automatically?
vbscript
text box
MsgBox CStr(Date)
or to a log file
objFile.WriteLine Date
|
|

January 29th, 2007, 04:46 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No.I have connected it to the Database.Thanks.
Do you have the code for the insertion of Date and Time into two text boxes...If yes, then please give.I will be very thankful to you..
|
|

January 29th, 2007, 05:28 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
GIve me a reply anybody.....pls
|
|

January 29th, 2007, 06:16 AM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
' Displays the date
Me.TextBox1.Text = DateTime.Now.ToShortDateString
' Displays the time
me.textbox1.text = datetime.now.ToShortTimeString
|
|

January 29th, 2007, 07:15 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Will the below code work? I tried it, but not coming properly.
Quote:
quote:Originally posted by HaveHave2222
' Displays the date
Me.TextBox1.Text = DateTime.Now.ToShortDateString
' Displays the time
me.textbox1.text = datetime.now.ToShortTimeString
|
|
|

January 29th, 2007, 08:36 AM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Which version of Visual Basic do you use?
Tested with version 2005.net, works fine?!
|
|

January 29th, 2007, 10:26 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am working with VB Version 6.
Nanda Kumar
Quote:
quote:Originally posted by HaveHave2222
Which version of Visual Basic do you use?
Tested with version 2005.net, works fine?!
|
|
|

January 30th, 2007, 01:00 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In vb6.0 use this (any one, which you need)
MsgBox FormatDateTime(Now, vbShortDate)
MsgBox FormatDateTime(Now, vbGeneralDate)
MsgBox FormatDateTime(Now, vbLongDate)
MsgBox FormatDateTime(Now, vbLongTime)
MsgBox FormatDateTime(Now, vbShortTime)
To use just system date
msgbox Date
when you need, just the system date to be inserted,
dim s as string
s = cstr(date)
use s in your insert sql statement by concatenating it in the proper field place.
hope this helps.
With Regards,
Raghavendra Mudugal
|
|

February 13th, 2007, 06:38 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thankz.
How can we get back the datas written into the DB,into a form?
I was unable to do it.How can we create a Pop-up Calendar in VB?
Nanda Kumar
Quote:
quote:Originally posted by Raghavendra_Mudugal
In vb6.0 use this (any one, which you need)
MsgBox FormatDateTime(Now, vbShortDate)
MsgBox FormatDateTime(Now, vbGeneralDate)
MsgBox FormatDateTime(Now, vbLongDate)
MsgBox FormatDateTime(Now, vbLongTime)
MsgBox FormatDateTime(Now, vbShortTime)
To use just system date
msgbox Date
when you need, just the system date to be inserted,
dim s as string
s = cstr(date)
use s in your insert sql statement by concatenating it in the proper field place.
hope this helps.
With Regards,
Raghavendra Mudugal
|
|
|
 |