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.C ontrol
Dim txtControl As TextBox
For Each ThisControl In Me.Controls
If ThisControl.Get Type().ToString () =
"system.Web.UI. WebControls.Tex tBox" Then
txtControl = CType(ThisContr ol, TextBox) ' am I casting this
correctly???
txtControl.Text = "I'vechange d" 'Doesn't work
End If
Next ThisControl
-----------------------------------
I tried ThisControl = CType(ThisContr ol, 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