Vb net combobox validating event

Although not explicitly stated below, you should also impose appropriate limits on the input length for the remaining fields.

The password fields are a good example of a situation where you can reduce the requirements for data validation by imposing such a limit.

For our Visual Basic applications, we will need to work a little harder to ensure that the input is valid, because we will need to define and code our own validation rules.

In a software project of any size, the task of determining what valid data is usually undertaken long before any code is written, and is part of an initial requirements analysis phase.

Some common data validation requirements are outlined below.

The first field on the form is the The Max Length property determines the maximum number of characters that the user can enter in a field such as a text box or (in this case) combo box.

We have therefore allowed the user the opportunity to enter a title that is not on the list, such as "Doctor" or "Professor", but have restricted the length of the input string to prevent abuse.

Dim str Allowed Chars As String = "0123456789() - " If Len(txt Telephone.

Text) = 0 Then Exit Sub Else For i = 0 To Len(txt Telephone.

Leave a Reply