Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is event handling in C# totally different from VB.NET

Status
Not open for further replies.

fr2

Programmer
May 13, 2008
45
US
I am kinda newbie in C#. ... Done a lot in VB.NET .. I'm working on Winforms development .. and in VB .. when u generate a dataset Customer .. in the IDE ... when u "view code" on the generated dataset .. these events show up to select from ...

CustomerDataset events
CustomerDataTable events

n u can select ColumnChanged event .. or TableNewRow event .. n code accordingly ...

I thought the only difference with C# was syntax ... but it appears to be more as I caanot find these events .. when I try to do the Winform project with C#. .... Do I have to go study delegates or something?

How can I use the IDE to get these events ... I'm using VS2008 now .. but I presume the same issue with VS2005 anyway as far as events in C#
 
you get the events by referencing them.
CustomerDataset.NameOfEvent += handler for event;
CustomerDataset.NameOfEvent -= handler for event;

there is a way to access these from the properties dialog box, but I can't remember exactly. it's been a long time since I used any of the GUI wizards to write code. something like an extra tab or shortcut icon at the top of the properties window.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Yes - near the top of the properties window there is a small lightning bolt. Clicking on that should display all events available for the selected control.
 
sorry .. not for the Dataset .... there is no lightning bolt "event" on top of the properties window ...

for a button control say .. yes .. there is a lightning bolt .. but not for the dataset.

jmeckley .... can u elaborate a bit on where u reference the events ....
the event handler i beleieve is a method in the partial database class ...

where do u put this!
CustomerDataset.NameOfEvent += handler for event;
CustomerDataset.NameOfEvent -= handler for event;

 
wherever you need it. usually in the code calling the dataset. the systems I have designed don't usually require large amounts of event handling. most, if not all happens at the UI level. button click, grid sort, that sort of thing.

another way to look at it. wiring an event for a dataset is not different than wiring an event for the GUI.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top