Click here to Skip to main content
16,014,650 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 9:13
XRaheemX7-Oct-05 9:13 
GeneralRe: Cursor position Pin
Agyeman7-Oct-05 9:28
Agyeman7-Oct-05 9:28 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 9:31
XRaheemX7-Oct-05 9:31 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 10:14
XRaheemX7-Oct-05 10:14 
AnswerRe: Cursor position Pin
Wjousts7-Oct-05 7:07
Wjousts7-Oct-05 7:07 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 7:21
XRaheemX7-Oct-05 7:21 
QuestionCustom Controls and events Pin
Red_Wizard_Shot_The_Food7-Oct-05 3:46
Red_Wizard_Shot_The_Food7-Oct-05 3:46 
AnswerRe: Custom Controls and events Pin
XRaheemX7-Oct-05 5:37
XRaheemX7-Oct-05 5:37 
Create a custom event delegate and event inside the control that your main form can use. When the in-control button is clicked have it check the custom event for registrars and fire it off it they exits. Examples: (I wrote this in the web browser, not a compiler so there may be a few compiler mistakes)

public delegate void OnClickStart(object,SystemEventArgs);
public event OnClickStart ClickStart;


private void button1_Clicked(object sender, SystemEventArgs e)
{
   if(this.ClickStart != null)
   {
      this.ClickStart(sender,e);
   }
}


Now in your main form use the code like such:

CustomControl cc = new CustomControl;
cc.ClickStart += new cc.OnClickStart(Mainform_ClickStart);

public void Mainform_ClickStart(object sender, SystemEventArgs e)
{
   //Make sure that if you do anything in here that could cause the form to PAINT that you
   //Use the this.Invoke method to invoke your MainForm methods.  If you do not do this
   //you could have major threading issues and your form could lock up
}


Try this out and let me know if you have any other questions.

-- modified at 11:41 Friday 7th October, 2005
GeneralRe: Custom Controls and events Pin
Red_Wizard_Shot_The_Food7-Oct-05 5:56
Red_Wizard_Shot_The_Food7-Oct-05 5:56 
GeneralRe: Custom Controls and events Pin
XRaheemX7-Oct-05 6:55
XRaheemX7-Oct-05 6:55 
GeneralRe: Custom Controls and events Pin
therealmccoy7-Oct-05 5:50
therealmccoy7-Oct-05 5:50 
QuestionSystem.Diagnostic.Process question/problem Pin
XRaheemX7-Oct-05 3:28
XRaheemX7-Oct-05 3:28 
AnswerRe: System.Diagnostic.Process question/problem Pin
therealmccoy7-Oct-05 7:59
therealmccoy7-Oct-05 7:59 
GeneralRe: System.Diagnostic.Process question/problem Pin
XRaheemX7-Oct-05 8:02
XRaheemX7-Oct-05 8:02 
GeneralRe: System.Diagnostic.Process question/problem Pin
therealmccoy7-Oct-05 8:57
therealmccoy7-Oct-05 8:57 
Questionaccessing a C DLL with C# Long/Int problem Pin
CalvinB7-Oct-05 3:26
CalvinB7-Oct-05 3:26 
AnswerRe: accessing a C DLL with C# Long/Int problem Pin
mav.northwind7-Oct-05 4:15
mav.northwind7-Oct-05 4:15 
GeneralRe: accessing a C DLL with C# Long/Int problem Pin
CalvinB7-Oct-05 4:59
CalvinB7-Oct-05 4:59 
GeneralRe: accessing a C DLL with C# Long/Int problem Pin
leppie7-Oct-05 7:25
leppie7-Oct-05 7:25 
QuestionData Access & Tab Control Pin
rich_wenger7-Oct-05 2:49
rich_wenger7-Oct-05 2:49 
QuestionSoftware Architecture - HELP! Pin
trjones17-Oct-05 1:44
trjones17-Oct-05 1:44 
AnswerRe: Software Architecture - HELP! Pin
Dan Neely7-Oct-05 2:04
Dan Neely7-Oct-05 2:04 
AnswerRe: Software Architecture - HELP! Pin
Carl Mercier7-Oct-05 4:47
Carl Mercier7-Oct-05 4:47 
Questionconverting array of byte to string in c# Pin
TssPrasad7-Oct-05 1:16
sussTssPrasad7-Oct-05 1:16 
AnswerRe: converting array of byte to string in c# Pin
Andrew Kirillov7-Oct-05 1:34
Andrew Kirillov7-Oct-05 1:34 

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.