<b>Tranlation of New Event<b>
-
Hi everybody, I have a question regarding new events in VS2003. I have read that it is not possible in 2003 but is available in 2005. I have found some code I wish to translate from C# but can't seem to figure it out. Does anyone know how to do this: public new event DateCancelEventHandler Validating { add{this.validating+=value;} remove { try { this.validating-=value; } catch(Exception ex) { throw new ArgumentException(ex.Message ,"Validating"); } } } in vb.net? thank you eatwork -- modified at 18:17 Thursday 4th May, 2006
-
Hi everybody, I have a question regarding new events in VS2003. I have read that it is not possible in 2003 but is available in 2005. I have found some code I wish to translate from C# but can't seem to figure it out. Does anyone know how to do this: public new event DateCancelEventHandler Validating { add{this.validating+=value;} remove { try { this.validating-=value; } catch(Exception ex) { throw new ArgumentException(ex.Message ,"Validating"); } } } in vb.net? thank you eatwork -- modified at 18:17 Thursday 4th May, 2006
Our Instant VB C# to VB converter produces: Public Shadows Custom Event Validating As DateCancelEventHandler AddHandler(ByVal value As DateCancelEventHandler) AddHandler Me.validating, value End AddHandler RemoveHandler(ByVal value As DateCancelEventHandler) Try RemoveHandler Me.validating, value Catch ex As Exception Throw New ArgumentException(ex.Message,"Validating") End Try End RemoveHandler RaiseEvent(ByVal sender As Object, ByVal e As EventArgs) End RaiseEvent End Event David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter and VB to C++ converter Instant J#: VB to J# converter Clear VB: Cleans up VB.NET code Clear C#: Cleans up C# code
-
Our Instant VB C# to VB converter produces: Public Shadows Custom Event Validating As DateCancelEventHandler AddHandler(ByVal value As DateCancelEventHandler) AddHandler Me.validating, value End AddHandler RemoveHandler(ByVal value As DateCancelEventHandler) Try RemoveHandler Me.validating, value Catch ex As Exception Throw New ArgumentException(ex.Message,"Validating") End Try End RemoveHandler RaiseEvent(ByVal sender As Object, ByVal e As EventArgs) End RaiseEvent End Event David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter and VB to C++ converter Instant J#: VB to J# converter Clear VB: Cleans up VB.NET code Clear C#: Cleans up C# code
Hello David, Thank you for your response. I have tried the code you supplied, but it does not seem to work in VS2003. It says that an end of statement is expected on the line "Event Validating As DateCancelEventHandler" and everything else after that generates some code errors. Do you know if it is possible to create custom events in VB.net, similar to those in C#? Thanks eatwork
-
Hello David, Thank you for your response. I have tried the code you supplied, but it does not seem to work in VS2003. It says that an end of statement is expected on the line "Event Validating As DateCancelEventHandler" and everything else after that generates some code errors. Do you know if it is possible to create custom events in VB.net, similar to those in C#? Thanks eatwork
Custom events are not available in VB 2003. David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter and VB to C++ converter Instant J#: VB to J# converter Clear VB: Cleans up VB.NET code Clear C#: Cleans up C# code