Log in

View Full Version : [ask] VB 2005 buat button nambah event OnClicknya gagal


Servermaster
20th November 2011, 02:04 AM
Saya mau buat button dengan codingan. Dan berhasil. Sekarang saya mau tambah'i action onClick didalamnya tapi kok gagal ya??



Ini listing programnya


Code:

Public Class Form1
Dim b As New Button
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
b.Text = "Coba"
Me.Controls.Add(b)
End Sub

Private Sub b_onClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b.Click 'Disini errornya.
b.Width = b.Width * 2
Me.Controls.Add(b)
End Sub
End Class

Katanya errornya "Handles clause requires a WithEvents variable defined in the containing type or one of its base types."



Kenapa ya?



Maklum baru belajar VB

</div>