October 18th, 2011, 12:58 PM
Simple form validation
I'm fairly new to Visual Studio, i've done VBScript and ASP in the past, but just got a new position getting myself back into it. What I am trying to do is make a form validation program so if a user doesn't fill in parts of the form and click "Next" the label associated with the textbox will turn red to show them what info is left to enter.
What I am doing is checking to see whether any information was entered into the designated areas, if not I store a label name in a single dimension array and increment the error counter by 1, to show that errors exist
MyArray(0) = "PatLabel0"
ErrorCount += 1
I store any errors into this array with the corresponding label name, I then am trying to use a for loop to go through the records, and if it is set to turn that label fontcolor = color.red as follows;
if this is possible please let me know, if not let me know that as well, and if you might have any idea(s) or a direction to point me in? Thank you for taking time out of your days to look this over for me, i really appreciate it this early in my coding ventures.
If (ErrorCount <> 0) Then
Dim Lbl As String
For i = 0 To UBound(MyArray)
Lbl = MyArray(i) & ".forecolor = color.red"
This is where i'd like to then echo or print the variable Lbl so that it will alter the Label associated with the corresponding array value and change it to red
Me.TabControl1.TabPages(1).Enabled = False
TabPage3.Enabled = True
TabControl1.SelectedTab = TabPage3
November 8th, 2011, 05:28 PM
Do you have some code that's not working or giving errors? If so show it and whatever errors you get.
Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
December 7th, 2011, 03:16 PM
how can we help
I agree with the moderator how can we help when we cannot see you actual problem...
Originally Posted by nickg21
you talk about a lable on aform/page but you refer to a new thing that you create at the time of checking, infact at the point of having a problem.
such a new thing is not the faulty thing or even something that talks about it. the array you need to talk about and too if it exists is the array containing the offending thing that needs filled in or altered.
so you can see it is hard to point you i the right direction when the ofending thing is not even in your code!
bill stewart - here to talk