hi every1...
i hv a doubt in updating my date...
i hv a textbox asking for the number of days(days1).... n a dtpicker1 that should show the date after the number of days(days1) from the date the form is run and submitted.... there is a lable today that takes the current system date of the computer... so i hv to add the number of days(days1) to the date displayed in today...
i hope im clear enough.. please help!

post the code that you've done...

Do you mean something like this:

' Get current date
Label1.Text = System.DateTime.Now.ToString
' User enters number of days in the TextBox. Lets say 8 days
TextBox1.Text = "8"
' Now calculate date for DateTimePicker
DateTimePicker1.Value = CDate(Label1.Text).AddDays(CInt(TextBox1.Text))

And now the DatetimePicker shows: "1. October 2008" (exact format depends on your locale settings).

:$ This is VB6, not VB.NET, sorry. Let's try again...

' Get current date
Label1.Caption = Now
' User enters number of days in the TextBox. Lets say 8 days
Text1.Text = "8"
' Now calculate date for DateTimePicker
DTPicker1.Value = DateAdd("d", CInt(Text1.Text), CDate(Label1.Caption))

And now the DTPicker shows: "1.10.2008" (exact format depends on your locale settings).

thanks a lot... it worked great!...

' Get current date
Label1.Caption = Now
' User enters number of days in the TextBox. Lets say 8 days
Text1.Text = "8"
' Now calculate date for DateTimePicker
DTPicker1.Value = DateAdd("d", CInt(Text1.Text), CDate(Label1.Caption))

hv a good day!

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.