Results 1 to 5 of 5

Thread: [02/03][Resolved] declaration issue--4th post onwards

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    490

    Resolved [02/03][Resolved] declaration issue--4th post onwards

    i am trying to shorten my code, so instead of having errorprovider for each textbox i want to programatically reduce using something like the following.
    although i dont get any errors, it doesnt do the work either.please help
    cheers
    For Each txerr As Control In firstMdiChild.Controls
    If TypeOf txerr Is TextBox Then
    'here i want to declare many textboxes , two in this example.
    'if i declare one it works, but as soon as i declare more it doesn't work.
    Dim errpro() As String = {"TextBox6", "TextBox7"}
    'here i am comparing the name of the textbox with errpro
    If txerr.Name Is errpro Then
    ErrorProvider1.SetError(txerr, "Cannot leave blank")
    Else
    ErrorProvider1.SetError(txerr, "")
    End If
    End If
    Next
    Last edited by indiewolf; Oct 22nd, 2007 at 07:56 AM. Reason: resolved
    visual basic.net (2008)

    .net framework 3.5


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width