plz tell me how can I add date box in the vb.net form

Recommended Answers

All 5 Replies

you mean just show date in label?
try this code :

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Label1.Text = System.DateTime.Today.ToLongDateString
End Sub

i was received your pm. if this solved, please mark it solved.

plz tell me how can I add date box in the vb.net form

adding a date box? do you mean a label or textbox control or are you talking about a calendar control, where the user can pick a date from a calendar type GUI?

if it's a textbox or label you can use the System Date and Time function or you can use the Now() and use Format(Now, "MMMM DD, YYYY") will give you February 19, 2008

or Format(Now"MM/DD/YYYY") will give you 02/19/2008

Date will give you a short date as in the previous example

Time will give you the current time in the computer the software is running.

Take a look at your Date/Time format on MSDN newsgroups for additional information.


If on the other hand, you're attempting to add a calendar control, you need to make sure it's in your toolbox controls and just drag it onto the form and you'll see a long date and time format. If you click on properties, you can change to other formats.

maybe this help to to make date move every 1 day.

Dim StarDate As Date = New Date(2011,1,1)
Dim EndDate As Date = New Date(2011,12,31)

Do Until (StarDate.Equal(EndDate))
  StarDate = StarDate.AddDays(1)
Next

Hope this help.

You can simply use the DateTimePicker control

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.