acces a control by its name

paulpiscoi
12-18-2003, 07:31 AM
Hello

how can I acces a control using a string representing the name of that control?

In vb 6 it was Controls("TextBox1").text="blablabl" but it seems do be different in .NET.

Thank you,

Paul.

Csharp
12-18-2003, 07:49 AM
like this ...

Dim ctl As Control
For Each ctl In Controls
If ctl.GetType Is GetType(TextBox) Then
If ctl.Name = "TextBox1" Then
ctl.Text = "some text"
End If
End If
Next

paulpiscoi
12-18-2003, 08:04 AM
Thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum