user741319
user741319

Reputation: 625

Attaching event handlers in Visual Basic .NET

What’s the equivalent of the C# += operator when used to add event handlers in VB.NET?

TreeView1.TreeNodeDataBound += new TreeNodeEventHandler(TreeView1_TreeNodeDataBound);

Upvotes: 1

Views: 132

Answers (2)

NoAlias
NoAlias

Reputation: 9193

First define a method with the same signature as the event and use the AddHandler Statement to tie the event with the method.

Upvotes: 1

MicSim
MicSim

Reputation: 26796

Something like:

AddHandler TreeView1.TreeNodeDataBound, AddressOf TreeView1_TreeNodeDataBound

Upvotes: 4

Related Questions