tags:

views:

102

answers:

1

I have a base Windows Form with a control. I have declared the control to be protected so his siblings will be able to handle properties, methods and events. This form is written in c#.

One of my clients is using VB.NET, and they have created a new inherited form in their project. Everything works fine ...

But, When they want to handle the control's clicked event in vb.net they're getting this error message:

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

Can anybody tell me what should i do on the c# form to let the inherited form in vb.net use the control events?

Thanks for your help!

+1  A: 

Two options:

  • Write some VB which declares a protected WithEvents variable, then decompile it to see what the VB compiler does. (I believe that it makes it a property for one thing, and probably adds a bunch of other bits and pieces.)

  • Tell them not to use a Handles clause - get them to subscribe explicitly in the same way that you would from C#, using AddHandler and AddressOf.

Jon Skeet