Great community. Great ideas.
Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.
February 9th, 2013, 05:45 PM
Validation Rule for TextBox
This is my first post here so Hi everyone.
I am new to VB and I am creating program that calculate the area of the room and calculate the price of the paint etc. One of the restriction is that the height of the room must be between 2 and 6 and the length must be between 1 and 25. I have two text boxes, one for hight and one for length. I need to add validation rule for both of them. I tried few codes but none of the worked for me. I was still able to calculate any number.
February 9th, 2013, 10:48 PM
I forgot to add that I am using Windows Forms Application (I am not sure if it does matter or not).
February 25th, 2013, 12:54 PM
Validation rules are generally set at the table level of a database design. However, you are using a smart form that will only use the variables for a temporary time, the time needed to perform your calculation. On the forms properties section for each of the controls, be sure that you can enter integer values. Look for a validation field to enter your min and max values. DO NOT use double quotes when assigning the int values. Should look something like this:
Validation Rule: >=2 AND <=6
Between 2 AND 6.
Too many different ways to handle this validation. OPEN AN
June 6th, 2013, 07:29 AM
First of all the easiest way is change the textbox to combobox and add item what you want only.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If Val(TextBox1.Text) > 6 Or Val(TextBox1.Text) < 2 Then
MsgBox("You can entered between 2 to 6.", MsgBoxStyle.Information, My.Application.Info.ProductName)
TextBox1.Text = ""
By udita in forum Microsoft Access Help
Last Post: August 6th, 2009, 01:48 PM
By KeiFeR123 in forum Microsoft Access Help
Last Post: October 3rd, 2004, 10:53 PM
By x_c4_4u in forum Visual Basic Programming
Last Post: September 13th, 2004, 03:14 AM
By canadian in forum Microsoft Access Help
Last Post: June 9th, 2004, 11:47 AM
By raeleong in forum Microsoft Access Help
Last Post: May 14th, 2004, 02:35 AM