Private Sub submitBtn_Click(ByVal sender As System.Object, ByVal e
   As System.EventArgs) Handles submitBtn.Click
          IF DoesFieldHaveBlanks(fname,lname,city,state,zip) THEN
                 return()
         END IF
 end sub

sub DoesFieldHaveBlanks(ByVal ParamArray ArrayTextBoxes() as TextBox)
    dim counter as integer
    dim badfield as boolean=false
    for counter=0 to Ubound(ArrayTextBoxes)
         If Arraytextboxes(counter).Text.Trim()="" THEN
             Arraytextboxes(counter).ForeColor=Color.Red
             badfield=false
         Else
             Arraytextboxes(counter).ForeColor=Color.Black
        End IF
   next
end sub


On Tue, 7 Dec 2004 10:28:34 -0500, Mike Appenzellar
<[EMAIL PROTECTED]> wrote:
>  That looks like it could work...my problem now is this..might be a
>  state problem? When I submit the form the first time it works, but
>  then even if I have a value in say fnameTxt, it still keeps the
>  fnameLbl red...maybe the solution that was just provided to me will
>  fix that though?
> 
> 
>  
>  
>  On Tue, 7 Dec 2004 08:36:40 -0500, Charles Carroll <[EMAIL PROTECTED]>
> wrote:
>  > I wa thinking something like this (much shorter):
>  > 
>  >   Private Sub submitBtn_Click(ByVal sender As System.Object, ByVal e
>  >     As System.EventArgs) Handles submitBtn.Click
>  >            IF DoesFieldHaveBlanks(fname,lname,city,state,zip) THEN
>  >                   return()
>  >           END IF
>  >   end sub
>  > 
>  > sub DoesFieldHaveBlanks(ByVal ParamArray ArrayTextBoxes() as TextBox)
>  >      dim counter as integer
>  >      dim badfield as boolean=false
>  >      for counter=0 to Ubound(ArrayTextBoxes)
>  >           If Arraytextboxes(counter).Text.Trim()
>  >               Arraytextboxes(counter).ForeColor=Color.Red
>  >               badfield=false
>  >          End IF
>  >     next
>  > end sub
>  > 
>  > 
>  >   
>  > On Mon, 6 Dec 2004 17:34:30 -0600, Peter Brunone <[EMAIL PROTECTED]>
>  > wrote:
>  > >  
>  > >        Well, I was thinking something like this:
>  > >  
>  > >  Private Sub submitBtn_Click(ByVal sender As System.Object, ByVal e
>  > >    As System.EventArgs) Handles submitBtn.Click
>  > >           Dim binFailed As Boolean = False
>  > >  
>  > >           If fnameTxt.Text.Trim() = "" Then
>  > >               fnameLbl.ForeColor = Color.Red
>  > >               binFailed = True
>  > >           End If
>  > >           If lnameTxt.Text.Trim() = "" Then
>  > >               lnameLbl.ForeColor = Color.Red
>  > >               binFailed = True
>  > >           End If
>  > >  
>  > >  ...and so on until the end, where you'd do this right before the
>  > >  database operation:
>  > >  
>  > >  If binFailed = True Then
>  > >     Return
>  > >  End If
>  > > 
>  > > 
>  > >  
>  > >  
>  > >  -----Original Message-----
>  > >  From: mappenzellar [mailto:[EMAIL PROTECTED] 
>  > >  
>  > >  Peter, 
>  > >  
>  > >  Can you be more specific with a couple lines of code as an example? I 
>  > >  am a newbie so please be patient with me. As far as the gazillion if 
>  > >  statements, how else can I achieve what I am after? What I am after 
>  > >  is this, I have a form and am doing validation. What I want is to 
>  > >  check each text box for validation and if it is empty for example 
>  > >  then turn the Lbl to red. I know there are built in validation 
>  > >  functions but I dont' think they can achieve turning a label to red.


------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to