I am working on validating a combo box. This does have a list of possible values but also allows for editing. So for example if the user does not select one of the available cities in the list they can type it in.

I have tried using the validation event but I seem to not begetting it.

ie...


Private Sub txtAddress1_Validating(ByVal sender As Object, ByVal _
e As System.ComponentModel.CancelEventArgs) Handles _
txtAddress1.Validating
'Check to see if the first name textbox is empty

If CType(sender, TextBox).Text = "" Then
MessageBox.Show("The first line of the address is required.", "Required Information", MessageBoxButtons.OK, MessageBoxIcon.Warning)
e.Cancel = True
End If

End Sub

It is a combo box. I must have grabbed the wrong section of code. I got it later last night. Thanks for asking.

I am working on validating a combo box. This does have a list of possible values but also allows for editing. So for example if the user does not select one of the available cities in the list they can type it in.

I have tried using the validation event but I seem to not begetting it.

ie...


Private Sub txtAddress1_Validating(ByVal sender As Object, ByVal _
e As System.ComponentModel.CancelEventArgs) Handles _
txtAddress1.Validating
'Check to see if the first name textbox is empty

If CType(sender, TextBox).Text = "" Then
MessageBox.Show("The first line of the address is required.", "Required Information", MessageBoxButtons.OK, MessageBoxIcon.Warning)
e.Cancel = True
End If

End Sub

This question has already been answered. Start a new discussion instead.