Click here to Skip to main content
15,889,176 members
Home / Discussions / C#
   

C#

 
Generalwindows service written in C++, COM objects, call from C# Pin
alma31-Jul-03 3:11
alma31-Jul-03 3:11 
GeneralRe: windows service written in C++, COM objects, call from C# Pin
alma31-Jul-03 23:20
alma31-Jul-03 23:20 
Generalrunning function in Form from UserControl Pin
Hovik Melkomian31-Jul-03 1:23
Hovik Melkomian31-Jul-03 1:23 
GeneralRe: running function in Form from UserControl Pin
Rampas Tomas31-Jul-03 2:09
Rampas Tomas31-Jul-03 2:09 
GeneralRe: running function in Form from UserControl Pin
Hovik Melkomian3-Aug-03 2:40
Hovik Melkomian3-Aug-03 2:40 
GeneralRe: running function in Form from UserControl Pin
Rampas Tomas3-Aug-03 21:34
Rampas Tomas3-Aug-03 21:34 
GeneralRe: running function in Form from UserControl Pin
Hovik Melkomian4-Aug-03 2:54
Hovik Melkomian4-Aug-03 2:54 
GeneralRe: running function in Form from UserControl Pin
Rampas Tomas4-Aug-03 3:38
Rampas Tomas4-Aug-03 3:38 
You have almost everything, but you have to add a couple of things:
1. You must provide definition for the MyCustomEventArgs (look at my previous exmple)
2. Define click event method for buttonNew button, and in this method call :

private void buttonNew_Click(object sender, System.EventArgs se)
{
if(NewRecord != null)
NewRecord(this, new MyCustomEventArgs());
}
3. According to me, it would be better to remove the delegate outside the class definition ( place it simply in dabir namespace )

4. Finally in your form where you are using your custom control register the appropriate method with similar signature as the delegate have.

//ArrowControl definition
ArrowControl ctrl = new ArrowControl();

//Form construktor
public MyForm()
{
ctrl.NewRecord += new MyControEventHandeler(NewRecordHandler);
}

public void NewRecordHandler(object sender, MyCustomEventArgs e)
{
// do appropriate things with new record Smile | :)
}


Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCP
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------

To be or not to be is true...
George Bool
GeneralRe: running function in Form from UserControl Pin
Hovik Melkomian4-Aug-03 3:53
Hovik Melkomian4-Aug-03 3:53 
GeneralRe: running function in Form from UserControl Pin
Hovik Melkomian4-Aug-03 3:22
Hovik Melkomian4-Aug-03 3:22 
GeneralRe: running function in Form from UserControl Pin
Rampas Tomas4-Aug-03 3:48
Rampas Tomas4-Aug-03 3:48 
GeneralRe: running function in Form from UserControl Pin
Hovik Melkomian4-Aug-03 4:13
Hovik Melkomian4-Aug-03 4:13 
GeneralRe: running function in Form from UserControl Pin
Hovik Melkomian16-Aug-03 5:28
Hovik Melkomian16-Aug-03 5:28 
GeneralProduct Key vs ProductID Pin
CezarT31-Jul-03 1:04
CezarT31-Jul-03 1:04 
GeneralRe: Product Key vs ProductID Pin
Ista31-Jul-03 6:58
Ista31-Jul-03 6:58 
GeneralRe: Product Key vs ProductID Pin
CezarT31-Jul-03 21:42
CezarT31-Jul-03 21:42 
GeneralResource Pin
deanoA31-Jul-03 0:06
deanoA31-Jul-03 0:06 
GeneralSystem.Management is undeclared Pin
michaDam31-Jul-03 0:06
michaDam31-Jul-03 0:06 
GeneralRe: System.Management is undeclared Pin
michaDam31-Jul-03 1:04
michaDam31-Jul-03 1:04 
Questionhow can i invoke parent class in child? Pin
zecodela30-Jul-03 23:19
zecodela30-Jul-03 23:19 
AnswerRe: how can i invoke parent class in child? Pin
Arjan Einbu31-Jul-03 0:59
Arjan Einbu31-Jul-03 0:59 
AnswerRe: how can i invoke parent class in child? Pin
Ista31-Jul-03 17:30
Ista31-Jul-03 17:30 
GeneralRe: Create New Folder Pin
William Forney30-Jul-03 20:12
William Forney30-Jul-03 20:12 
GeneralRe: Create New Folder Pin
Nick Seng30-Jul-03 22:09
Nick Seng30-Jul-03 22:09 
Generaltools for viewing dll Pin
zecodela30-Jul-03 18:07
zecodela30-Jul-03 18:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.