List controls in a web form
-
I am trying to list some controls (TextBoxes) in a web form. I tried using Collections, without success. Any help on this issue? Thanks! cghochberg
-
I am trying to list some controls (TextBoxes) in a web form. I tried using Collections, without success. Any help on this issue? Thanks! cghochberg
Not really sure as to what your asking for but as far as the control collections go, they're history in ASP.Net. If you wanted to use a collection to loop through controls then try the following.
For i = 0 to 9
Dim txtBox as TextBox = ctype(FindControl("TextBox" & i), TextBox)
If not txtBox is nothing then
'Do Something
End if
next iNow the above code is not tested so you may need tweak it but you should get the idea if looping through textboxes is what you are looking for. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
-
Not really sure as to what your asking for but as far as the control collections go, they're history in ASP.Net. If you wanted to use a collection to loop through controls then try the following.
For i = 0 to 9
Dim txtBox as TextBox = ctype(FindControl("TextBox" & i), TextBox)
If not txtBox is nothing then
'Do Something
End if
next iNow the above code is not tested so you may need tweak it but you should get the idea if looping through textboxes is what you are looking for. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
Thanks for the help! I did not receive a mail message, so I thought no one replied... I will keep you infomed about my progress and also if I find a solution. Regards, Carlos cghochberg