I have: Name of a button, and I want to change the text of it
Posted on 2007-03-30
I want to change the text of a button. What I know is the name of the button and the new text.
So I have tried this:
Private Sub me_text_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles me_text.TextChanged
GetControl(me_control.Text).Text = me_text.Text
Private Function GetControl(ByVal _Name As String) As Button
Dim entry As Control
For Each entry In Controls 'searching all controls
If entry.GetType.Name = "Button" Then 'only search for name if its a button
If entry.Name = _Name Then 'if the button has the name of the button that I want
Return entry 'return entry, which is a button
What is wrong?