Events & Delegates in VB question
-
Hello, I only recently started working in VB, so now I'm having an obvious syntax-wise question: I want to hook the .Click event of an object (sectionItem), inheriting from Panel to a Sub in my class. In C# this would simply be sectionItem.Click += new EventHandler(mySub) , but in VB I'm a bit confused. Could someone point me to the right actions? Tnx
-
Hello, I only recently started working in VB, so now I'm having an obvious syntax-wise question: I want to hook the .Click event of an object (sectionItem), inheriting from Panel to a Sub in my class. In C# this would simply be sectionItem.Click += new EventHandler(mySub) , but in VB I'm a bit confused. Could someone point me to the right actions? Tnx
you can use AddHandler in VB.NET inorder to bind an event dynamically Like,
AddHandler btnClose.Click, AddressOf btnClose_Click
where btnClose is a button and btnClose_Click is the function or the event handler for that button when that button is clicked MubashirEvery job is a self portrait of the person who did it.
-
you can use AddHandler in VB.NET inorder to bind an event dynamically Like,
AddHandler btnClose.Click, AddressOf btnClose_Click
where btnClose is a button and btnClose_Click is the function or the event handler for that button when that button is clicked MubashirEvery job is a self portrait of the person who did it.
-
you can use AddHandler in VB.NET inorder to bind an event dynamically Like,
AddHandler btnClose.Click, AddressOf btnClose_Click
where btnClose is a button and btnClose_Click is the function or the event handler for that button when that button is clicked MubashirEvery job is a self portrait of the person who did it.
There are two options in VB: 1. As described by Mubashir. 2. Using a "Handles" clause: e.g., Public Sub btnClose_Click(......) Handles btnClose.Click Some people prefer this more traditional VB way. However, of course this method only applies to cases that you know at design time.
David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter, VB to C++ converter Instant Python: C# to Python converter, VB to Python converter