|
-
Feb 15th, 2011, 02:37 PM
#1
Thread Starter
New Member
Binding action to button.
First of all I'd like to say that I'm completely new to programming and VB. Therefore I have a stupid problem.
I want to make a form that makes a button when loaded. How can I make this button work (meaning that something happens when button is clicked)?
At the moment my code is:
Public Class Form1
Dim button As New Button
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
button.Text = "Button"
Me.Controls.Add(button)
End Sub
Private Sub button_click()
MsgBox ("It works!")
End Sub
End Class
Of course, this code doesn't work. It makes succesfully a button on the form, but that button does noting.
I hope I made myself clear about what my aim is.
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
|