-
Convert C# codes to VB.NET
Dear All,
Try to understand the following C# codes. Can someone help me convert the
following codes to VB.NET? What is the meaning of += in C#?
public void InstantiateIn(Control container)
}
LiteralControl l = new LiteralControl();
l.DataBinding += new EventHandler(this.OnDataBinding);
container.Controls.Add(l);
}
Public void OnDataBinding(object sender, EventArgs e)
{
......
}
Thanks,
Steve
-
Re: Convert C# codes to VB.NET
Steve <vb.@127.0.0.1> wrote:
>
> Dear All,
> Try to understand the following C# codes. Can someone help me convert the
> following codes to VB.NET? What is the meaning of += in C#?
x += y is equivalent to x = x + y in C# or VB.NET.
However, C# supports operator overloading (letting you redefine the
meaning of +, for example, for a class), and sometimes language
designers get clever and use operator overloading for something that's
not especially intuitive. See C++ stream operations for the cannonical
example (they work by overloading the bit shifting operators).
> public void InstantiateIn(Control container)
> }
> LiteralControl l = new LiteralControl();
> l.DataBinding += new EventHandler(this.OnDataBinding);
The VB.NET equivalent of this line is
AddHandler l.DataBinding, Addressof(this.OnDataBinding)
> container.Controls.Add(l);
> }
>
> Public void OnDataBinding(object sender, EventArgs e)
> {
> .....
> }
>
> Thanks,
> Steve
>
--
Dave Rothgery
Picking nits since 1976
drothgery@alum.wpi.edu
http://drothgery.editthispage.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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks