PDA

View Full Version : Help - Reset DateTimePicker


Nerddette
04-21-04, 11:57 PM
(Apologies for double posting in VB forum - it won't happen again!)

Hi,

I am using VB.Net to create an application which includes a Date Time Picker. I have set the minimum and maximum dates which works fine.

I have a reset button on the form. When this is clicked, I want to reset the date time picker to the minimum date.

I have tried:

dtpStartDate.MinDate() but it tells me I have to give the value which is 20/01/1988 but obviously this is not the correct format. Also I think this command actually changes the Min date which I don't want to do.

dtpStartDate.Value(dtpStartDate.MinDate) but that didn't work either!

Please Help!

Nerddette

Nerddette
04-24-04, 09:43 AM
I've worked it out and posted in case someone else has the same problem.

'Created a global string variable with initial value
Dim gstrStartDate As String = "20/01/1988" '(Australian Date Format)

Private Sub btnReset_Click
'Set Start Date to 20/01/1988
gstrStartDate = "20/01/1988"
dtpStartDate.Value = Convert.ToDateTime(gstrStartDate)
End Sub

Nerddette