By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

c# -> vb.net

P: n/a
Sam
Hi,
I've seen this kind of thing in C# quite often :
cbo.Validating += new CancelEventHandler(cbo_Validating);
what is the vb.net equivalent ?

Please don't send me to
http://www.developerfusion.com/utili...sharptovb.aspx
I've already tried this and it's not translating properly.

Thx

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Public Sub cbo_Validating(<...some args...>) Handles cbo.Validating
... do whatever you want...
End Sub

<...some args...> must be the proper signature for the particular event you
are handling (cboValidating, btnClick, txtChange, etc.).
"Sam" <sa**************@voila.fr> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,
I've seen this kind of thing in C# quite often :
cbo.Validating += new CancelEventHandler(cbo_Validating);
what is the vb.net equivalent ?

Please don't send me to
http://www.developerfusion.com/utili...sharptovb.aspx
I've already tried this and it's not translating properly.

Thx

Nov 21 '05 #2

P: n/a
The direct equivalent would be (it only makes sense from within a method):
Private Sub test()
AddHandler cbo.Validating, AddressOf cbo_Validating
End Sub

But the alternative that Arthur provided (using "Handles" & "WithEvents") is
more in the style of VB.

David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter

"Sam" wrote:
Hi,
I've seen this kind of thing in C# quite often :
cbo.Validating += new CancelEventHandler(cbo_Validating);
what is the vb.net equivalent ?

Please don't send me to
http://www.developerfusion.com/utili...sharptovb.aspx
I've already tried this and it's not translating properly.

Thx

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.