prayank@cloudsentinels
Member
- Joined
- Dec 8, 2014
- Messages
- 5
- Programming Experience
- 1-3
VB.NET:
Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'some code
Dim MyButton As New Button()
With MyButton
.Location = New Point(12, 12)
.Size = New Size(75, 30)
.TabIndex = 0
.Text = TextBox1.Text
End With
scriptexplorer.Controls.Add(MyButton)
AddHandler MyButton.Click, AddressOf MyButton_Click
MsgBox("Done!")
Private Sub MyButton_Click(ByVal obj As Object, ByVal e As EventArgs)
Try
scriptexplorer.RichTextBox1.Text = Runcmd(mydocpath & "\" + TextBox1.Text + ".ps1")
scriptexplorer.RichTextBox1.Text = "success!"
Catch
scriptexplorer.RichTextBox1.Text = "error"
End Try
End Sub
So, here I am trying to create a new button with text specified in textbox1. The button is created in the form 'scriptexplorer' but the next time i load the form, its gone. So, i guess I need to save this info for the button created and call it everytime the form loads but dont know how to do it?
Please help me !