Results 1 to 2 of 2

Thread: Can someone translate this please

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Can someone translate this please

    Hi All

    I have been given this example code but it's in c#.
    I am a c# developer but I have to write this stuff in VB and have little knowledge of VB + the online convertors don't work with this.

    Code:
    report.Error += delegate(object innerSender, ErrorEventArgs eventArgs)
            {
                this.ReportViewer.Report = null;
                this.Label1.Text = eventArgs.Exception.Message.ToString();
            };
    Thanks folks :-)

    Parksie

  2. #2
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: Can someone translate this please

    VB 10 or higher:
    Code:
    AddHandler report.Error,
    	Sub(innerSender As Object, eventArgs As ErrorEventArgs)
    			Me.ReportViewer.Report = Nothing
    			Me.Label1.Text = eventArgs.Exception.Message.ToString()
    	End Sub
    Note that the 'Sub/End Sub' is an anonymous method, equivalent to the C# anonymous method via the 'delegate' keyword.
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width