JackBurton07
IS-IT--Management
Hi
I have a product start date which I am trying to validate. The user needs to input a date ( any date) in the correct format and then they will move down to the product selection combo box. I dont know how I can get it to validdate the date is in the correct format and then focus on the combo box - theres something wrong with my code
please help! thanks jb
Private Sub txtstartdate_Validating2(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtstartdate.Validating
Dim validdate As Boolean
validdate = False
If txtstartdate.Text.Length = 0 Then
MsgBox("Please the start date in DD/MM/YY format", MsgBoxStyle.Exclamation, "Empty field")
Else
Try
Dim cli_start As Date
cli_start = CDate(txtstartdate.Text)
Catch err As Exception
REM display a message box
MsgBox("Please enter the date correct format dd/mm/yy", MsgBoxStyle.Exclamation, "Incorrect date format")
txtstartdate.Text = "dd/mm/yy"
txtstartdate.Focus()
' problem is around here somewhere'
validdate = True
cboProduct1.Enabled = True
cboProduct1.Focus()
End Try
End If
End Sub
I have a product start date which I am trying to validate. The user needs to input a date ( any date) in the correct format and then they will move down to the product selection combo box. I dont know how I can get it to validdate the date is in the correct format and then focus on the combo box - theres something wrong with my code
please help! thanks jb
Private Sub txtstartdate_Validating2(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtstartdate.Validating
Dim validdate As Boolean
validdate = False
If txtstartdate.Text.Length = 0 Then
MsgBox("Please the start date in DD/MM/YY format", MsgBoxStyle.Exclamation, "Empty field")
Else
Try
Dim cli_start As Date
cli_start = CDate(txtstartdate.Text)
Catch err As Exception
REM display a message box
MsgBox("Please enter the date correct format dd/mm/yy", MsgBoxStyle.Exclamation, "Incorrect date format")
txtstartdate.Text = "dd/mm/yy"
txtstartdate.Focus()
' problem is around here somewhere'
validdate = True
cboProduct1.Enabled = True
cboProduct1.Focus()
End Try
End If
End Sub