Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old January 29th, 2007, 03:20 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default 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
  kumarc_n@yahoo.com

  #2 (permalink)  
Old January 29th, 2007, 04:25 AM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


  #3 (permalink)  
Old January 29th, 2007, 04:46 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default

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..

  #4 (permalink)  
Old January 29th, 2007, 05:28 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default

GIve me a reply anybody.....pls

  #5 (permalink)  
Old January 29th, 2007, 06:16 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default


' Displays the date
Me.TextBox1.Text = DateTime.Now.ToShortDateString

' Displays the time
me.textbox1.text = datetime.now.ToShortTimeString

  #6 (permalink)  
Old January 29th, 2007, 07:15 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default


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

  #7 (permalink)  
Old January 29th, 2007, 08:36 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Which version of Visual Basic do you use?

Tested with version 2005.net, works fine?!

  #8 (permalink)  
Old January 29th, 2007, 10:26 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default


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?!

  #9 (permalink)  
Old January 30th, 2007, 01:00 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #10 (permalink)  
Old February 13th, 2007, 06:38 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default

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




Similar Threads
Thread Thread Starter Forum Replies Last Post
setting system time angelboy C# 2005 1 May 4th, 2007 08:05 PM
How can I set system time & date in VB.net ? mike123abc Pro VB.NET 2002/2003 1 April 27th, 2007 10:00 AM
HOW CAN SYSTEM DATE N TIME BE CAPTURED IN A TXTBOX cnkumar74 VB Databases Basics 6 February 14th, 2007 02:09 AM
System Lockup time vincent737 C# 0 July 21st, 2005 05:58 AM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.