c# -> vb.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sam

    #1

    c# -> vb.net

    Hi,
    I've seen this kind of thing in C# quite often :
    cbo.Validating += new CancelEventHand ler(cbo_Validat ing);
    what is the vb.net equivalent ?

    Please don't send me to

    I've already tried this and it's not translating properly.

    Thx

  • Arthur Dent

    #2
    Re: c# -> vb.net

    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" <samuel.berthel ot@voila.fr> wrote in message
    news:1118762367 .398215.134990@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    > Hi,
    > I've seen this kind of thing in C# quite often :
    > cbo.Validating += new CancelEventHand ler(cbo_Validat ing);
    > 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
    >[/color]


    Comment

    • David Anton

      #3
      RE: c# -&gt; vb.net

      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
      Source code converters: Convert between C#, C++, Java, and VB with the most accurate and reliable source code converters

      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:
      [color=blue]
      > Hi,
      > I've seen this kind of thing in C# quite often :
      > cbo.Validating += new CancelEventHand ler(cbo_Validat ing);
      > 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
      >
      >[/color]

      Comment

      Working...