Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim asm = System.Reflection.Assembly.GetExecutingAssembly
- Dim myTypes As Type() = asm.GetTypes()
- Dim frm As Form
- For Each t As Type In myTypes
- If t.IsSubclassOf(GetType(System.Windows.Forms.Form)) AndAlso TextBox1.Text = t.Name Then
- frm = CType(Activator.CreateInstance(t), Form)
- frm.Hide()
- Dim thisButtonName As String = TextBox3.Text ' This is the name of the button I'm looking for
- Dim thisButtonName2 As String = TextBox2.Text ' this is the new tag name for that button
- ' Loop all controls in this form
- For Each ctrl As Control In Controls
- ' Is this control a button
- If TypeOf (ctrl) Is Button Then
- ' Is this the correct button
- If CType(ctrl, Button).Name = thisButtonName Then
- CType(ctrl, Button).Tag = thisButtonName2
- End If
- End If
- Next
- End If
- Next
- TreeView1.Nodes.Clear()
- For Each formprop In My.Forms.GetType.GetProperties
- Dim node = Me.TreeView1.Nodes.Add(formprop.Name)
- Dim form As Form = CType(formprop.GetValue(My.Forms, Nothing), Form)
- ControlsTree(node, form.Controls)
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement