how can i insert date and time into textbox ?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 17731 Views - Last Post: 10 July 2011 - 10:12 PM Rate Topic: -----

#1 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:11 AM

now i want to insert date and time in text box as it set in the computer ??
Is This A Good Question/Topic? 0
  • +

Replies To: how can i insert date and time into textbox ?

#2 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:12 AM

date time picker control
Was This Post Helpful? 0
  • +
  • -

#3 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:14 AM

it can insert it into text box ?????
Was This Post Helpful? 0
  • +
  • -

#4 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:16 AM

no you wont need a text box the date time picker will update the time and date when you start the porgram or is that not what you want
Was This Post Helpful? 0
  • +
  • -

#5 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:17 AM

no >> i want it in text box to insert it in db ?
Was This Post Helpful? 0
  • +
  • -

#6 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:19 AM

Also you can use: Now or followed by many values depends on what you need. Like Now.Date, Now.Day and others.... alot
Was This Post Helpful? 0
  • +
  • -

#7 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:21 AM

  Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        

        TextBox3.Text = Date.Now

    End Sub



it did not work

This post has been edited by el - general: 10 July 2011 - 09:22 AM

Was This Post Helpful? 0
  • +
  • -

#8 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:25 AM

No just TextBox3.Text = Now and if you need only date then TextBox3.Text = Now.Date

This post has been edited by smohd: 10 July 2011 - 09:26 AM

Was This Post Helpful? 0
  • +
  • -

#9 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:28 AM

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        TextBox3.Text = Now
    End Sub

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        TextBox3.Text = Today
    End Sub

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        TextBox3.Text = Now.Date
    End Sub


all these codes did not work
Was This Post Helpful? 0
  • +
  • -

#10 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:32 AM

Why you put them in text changed? Do you know when that event is executed? When do you want you date to appear? when form is loaded? or when button is clicked?
Was This Post Helpful? 0
  • +
  • -

#11 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:33 AM

all of these codes work but in button click >>> not automatically

no i want it when form is loaded ?
Was This Post Helpful? 0
  • +
  • -

#12 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:35 AM

Then put them in form_Load event, like:
 Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox3.Text = Now.Date
End Sub 

Was This Post Helpful? 3
  • +
  • -

#13 el - general  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 10-July 11

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:37 AM

ya I made it

thanks a lot (smohd) for your time

have a nice day
Was This Post Helpful? 0
  • +
  • -

#14 Elda  Icon User is offline

  • D.I.C Regular

Reputation: 31
  • View blog
  • Posts: 314
  • Joined: 30-December 10

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 09:38 PM

View Postel - general, on 11 July 2011 - 12:37 AM, said:

ya I made it

thanks a lot (smohd) for your time

have a nice day



I guess Sir Smohd deserves a plus sign? :)
Was This Post Helpful? 1
  • +
  • -

#15 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: how can i insert date and time into textbox ?

Posted 10 July 2011 - 10:09 PM

Quote

I guess Sir Smohd deserves a plus sign? :)

And he got it ;)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2