Hi
Sorry this is (a sort of) repost. I am trying to trim all text boxes
on my web form. I've got no problem with the trim function, I have a
problem with casting. I am told that if I want to access the Text
property, I need to have typed reference (castit to TextBox with CType
and set the value to the property). I don't exactly know how to do
this. Could somebody show me the code?
Here is what I have so far.
---------------------------------------
Dim ThisControl As System.Web.UI.Control
Dim txtControl As TextBox
For Each ThisControl In Me.Controls
If ThisControl.GetType().ToString() =
"system.Web.UI.WebControls.TextBox" Then
txtControl = CType(ThisControl, TextBox) ' am I casting this
correctly???
txtControl.Text = "I'vechanged" 'Doesn't work
End If
Next ThisControl
-----------------------------------
I tried ThisControl = CType(ThisControl, TextBox), but the properties
won't appear for thiscontrol.
Can somebody help in this casting so I can update or
get the text property here
Many thanks
Alex