Okay, I've finally given up on trying to do this. I only recently learnt to do it in vb.net and found it really useful. Translating that to C# is proving to be an absolute nightmare.
What I had in vb.net was this. A class that inherited and extended the data table class called xDataTable.
One of the main features of this extension is that the base data table will populate itself from a SQL server database if a populated SQLCommand is given to it.
I then added an event to the xDataTable which fired whenever the base data table was populated. Trying to do this in C# is proofing to be my worst nightmare. Can anyone help please.
Summary:
Class xDataTable will contain an event called hasData
Form fEditor should then add a handler to use this event.
Please could someone help and stop me from going back to vb
Thanks.
If you have a class xDataTable you should create a delegate like so
// Create Event
public delegate void HandleData();
public class xDataTable {
public event HandleData hasData
public void Fire() {
hasData();
}
}
//Register Event in Form
class registerEvent {
xDataTable xdata = new xDataTable();
ImplementationEvent myImpl = new ImplementationEvent();
xdata.hasData += new HandleData(myImpl.DoSometh
}
//Register Event in Form
class ImplementationEvent {
public void DoSomething() {
console.WriteLine("EventFi
}
}
Hope this helps,
Darren