关于对象
我在程序中定义了一个对象,请问如何继承它的事件
比如:dim cmb as combox我怎样写它的事件?最好有代码参考
[解决办法]
事件追加:
AddHandler cmb.GotFocus, AddressOf cmb_GotFocus
你可以在cmb_GotFocus中做你想要的处理,其他事件也可以类似来追加的.
[解决办法]
Public Class Form1
Dim cmb As ComboBox
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cmb = New ComboBox
With cmb
.Left = 6
.Top = 6
.Items.Add( "Items 1 ")
.Items.Add( "Items 2 ")
.Items.Add( "Items 3 ")
.Items.Add( "Items 4 ")
AddHandler cmb.SelectedIndexChanged, AddressOf cmb_SelectedIndexChanged
End With
Me.Controls.Add(cmb)
End Sub
Private Sub cmb_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
MsgBox( "cmb_SelectedIndexChanged ")
End Sub
End Class