473,395 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

VB to C#, need help with WithEvents

Tee
Hi,

I am converting a code from VB to C#.

in VB, it's
Private WithEvents MyButton As Button

what's the code in C# ?

I can't get the replacement for the "WithEvents" in C#.

Anyone know it?

Thanks.
Nov 16 '05 #1
4 1589

"Tee" <th*@streamyx.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi,

I am converting a code from VB to C#.

in VB, it's
Private WithEvents MyButton As Button

what's the code in C# ?

I can't get the replacement for the "WithEvents" in C#.

Anyone know it?


Simple: there isn't one.
Nov 16 '05 #2
Tee
Thanks anyway.
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:#8**************@TK2MSFTNGP10.phx.gbl...

"Tee" <th*@streamyx.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi,

I am converting a code from VB to C#.

in VB, it's
Private WithEvents MyButton As Button

what's the code in C# ?

I can't get the replacement for the "WithEvents" in C#.

Anyone know it?


Simple: there isn't one.

Nov 16 '05 #3
Hi Tee,

In C#, there isn't a WithEvents keyword.

What you do is this:
Button btn = new Button();
btn.Clicked += new 'ClickHandlertype'

+= is the operator used for bind methods to events.

Try this events tutorial in MSDN:
http://msdn.microsoft.com/library/en...tstutorial.asp

HTH,
Rakesh Rajan

"Tee" wrote:
Hi,

I am converting a code from VB to C#.

in VB, it's
Private WithEvents MyButton As Button

what's the code in C# ?

I can't get the replacement for the "WithEvents" in C#.

Anyone know it?

Thanks.

Nov 16 '05 #4
What he means is that you don't need an equivalent - C# is smart
enough to know what you mean once you make the declaration (ditto
for "Shadows", "Overloads", etc.).

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Zi | last post by:
I have a user control within a data grid. I am binding the user control to one of the values from the data grid. The data grid implements paging. It is all working ok for the first page but once i...
1
by: Machelle Chandler | last post by:
All, I'm trying to populate a datagrid with a data adapter that uses a stored procedure with a parameter. I get the below error when I run my code (as seen below). Any hints? If I delete...
0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
0
by: Benjamin Bittner | last post by:
Hallo NG, ive searched a lot in some google groups, and found many threads, but nothing that helped me. Here is the scenario: I have an aspx page which loads a user control in page.onInit like...
2
by: student | last post by:
Hi all, I'm having trouble with my datagrid, it is suppose to display a row from a table called "Calls" based on what is selected in the dropdownlist which displays the first and last name from...
11
by: CM Manager via DotNetMonster.com | last post by:
I am very frustrated due to this exception error I am receiving. I've tried searching numerous user support groups, Microsoft Support Net, Google, etc. and haven't found exactly my situation....
4
by: Philip Wagenaar | last post by:
I have made a form with a tab that containts groupboxes and those contain checkboxes. When I run the application sometimes the outlining for some groupboxes are not shown, if I switch tabs and...
3
by: Terry Olsen | last post by:
I'm trying to add a domain user to a local group using the code below: Dim LCL As New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim DOM As New...
15
by: active | last post by:
Below is a small but complete program that appears to show you can't retrive a Palette from the clipboard. This is true whether the palette is placed on the clipboard by Photoshop or Photoshop...
2
by: sweatha | last post by:
Hi friends This is sweatha, fresher MCA 2007 batch. Right now I am working in asp.net platform. My dillema is that I have created a registration form with the fields as username & password. And if...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.