#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    6
    Rep Power
    0

    Simple form validation


    Hey everyone,
    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;

    Code:
    Code:
    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
    Next
    Else
    Me.TabControl1.TabPages(1).Enabled = False
    TabPage3.Enabled = True
    TabControl1.SelectedTab = TabPage3
    End If
    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.

    -Nick Girard
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    Do you have some code that's not working or giving errors? If so show it and whatever errors you get.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    23
    Rep Power
    0

    how can we help


    Originally Posted by nickg21
    Hey everyone,
    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;

    Code:
    Code:
    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
    Next
    Else
    Me.TabControl1.TabPages(1).Enabled = False
    TabPage3.Enabled = True
    TabControl1.SelectedTab = TabPage3
    End If
    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.

    -Nick Girard
    I agree with the moderator how can we help when we cannot see you actual problem...

    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

IMN logo majestic logo threadwatch logo seochat tools logo