Difference between revisions of "Using events in VB.NET"

From Ribbon Commander Documentation
Jump to: navigation, search
(Created page with "== Background == You can subscribe to events of Dynamic RibbonX controls by using .NET events or .NET delegates. Here, we show how it can be done by using .NET ev...")
 
(Background)
Line 4: Line 4:
 
* Declare a member variable of the events source control type ''WithEvents''
 
* Declare a member variable of the events source control type ''WithEvents''
 
* Use Visual Studio to insert the desired event stubs
 
* Use Visual Studio to insert the desired event stubs
 +
 +
== Example ==
 +
In this example we will set up a UI that contains an rxButton control and subscribe to all its events.
 +
* Add a new class to [[temp|your  project]] and name it ''ButtonEventsUI''
 +
* Add the following code to your class
 +
<syntaxhighlight lang="vb" line>
 +
</syntaxhighlight>
 +
* Modify class ThisAddin in ThisAddin.vb as follows
 +
<syntaxhighlight lang="vb" line>
 +
</syntaxhighlight>
 +
 +
== Remarks ==

Revision as of 19:39, 15 March 2013

Background

You can subscribe to events of Dynamic RibbonX controls by using .NET events or .NET delegates. Here, we show how it can be done by using .NET events. In general you need to take the following steps:

  • Declare a member variable of the events source control type WithEvents
  • Use Visual Studio to insert the desired event stubs

Example

In this example we will set up a UI that contains an rxButton control and subscribe to all its events.

  • Add a new class to your project and name it ButtonEventsUI
  • Add the following code to your class
  1.  
  • Modify class ThisAddin in ThisAddin.vb as follows
  1.  

Remarks