|
-
March 15th, 2011, 09:35 PM
#1
[RESOLVED] *Ironic angry face* Dynamically creating methods for dynamically created buttons
Okay, I have this code.
Code:
Public Class Form1
Dim NPB As Button
Dim x As Integer
Private Sub NewProgramToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewProgramToolStripMenuItem.Click
Dim OpePro As String
OpenFileDialog1.ShowDialog()
OpePro = OpenFileDialog1.FileName
Process.Start(OpePro)
x = x + 25
NPB = New Button
NPB.Text = OpePro
NPB.Left = 5
NPB.Top = x
Controls.Add(NPB)
End Sub
End Class
As you can see, when I open a program from my menu, a new button will be created with text similar to this, "C:\Program ". The button it self will not do anything. How can I create the method at the same time the button it is for is created? Also how can I change the text do that it gives me, for example, CCleaner.exe instead of the whole target path? Also, I scream like a gerbil being hit on by a donkey in Tijuana.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|