0

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

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ehrendreich
0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.