Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Public Sub backblue(ByVal frm As Form, ByVal boxname As String)
  2. For i = 1 To 3
  3. CType(frm.Controls(boxname & i.ToString()), TextBox).BackColor = Color.LightBlue
  4. Next
  5. End Sub
  6.  
  7. Private Sub Button1_click and bla bla....
  8. backblue(Me, "txb1_")
  9. End Sub
  10.  
  11. Public Sub backblue(ByVal frm As Form, ByVal prefix As String)
  12. For i = 1 To 3
  13. Dim bxName as String = prefix & i.ToString()
  14. Dim bx as TextBox = CType(frm.Controls(bxName), TextBox)
  15. If bx Is Nothing Then
  16. MsgBox("Unable to find text box " +bxName)
  17. Dim mtch() As Control = frm.Controls.Find(bxName, true)
  18. If mtch.Length> 0 then
  19. bx = mtch(0)
  20. Else
  21. Continue For
  22. End if
  23. End If
  24. Bx.BackColor = Color.LightBlue
  25. Next
  26. End Sub
  27.  
  28. For Each box as Textbox In frm.Controls
  29. box.BackColor = Color.LightBlue
  30. Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement