Click here to Skip to main content
15,916,412 members
Home / Discussions / C#
   

C#

 
AnswerRe: Need Help Pin
Luc Pattyn13-Jul-10 21:49
sitebuilderLuc Pattyn13-Jul-10 21:49 
AnswerRe: Need Help Pin
Pete O'Hanlon13-Jul-10 22:02
mvePete O'Hanlon13-Jul-10 22:02 
QuestionNetwork Transaction Management...... Need Help... Pin
nEar_mO13-Jul-10 16:42
nEar_mO13-Jul-10 16:42 
AnswerRe: Network Transaction Management...... Need Help... Pin
Richard Andrew x6413-Jul-10 17:33
professionalRichard Andrew x6413-Jul-10 17:33 
GeneralRe: Network Transaction Management...... Need Help... Pin
nEar_mO13-Jul-10 17:40
nEar_mO13-Jul-10 17:40 
AnswerRe: Network Transaction Management...... Need Help... Pin
Peace ON13-Jul-10 19:49
Peace ON13-Jul-10 19:49 
QuestionTrigger a Parent Form Event From UserControl In TableLayoutPanel Pin
JessStuart13-Jul-10 14:32
JessStuart13-Jul-10 14:32 
AnswerRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
Richard Blythe13-Jul-10 16:12
Richard Blythe13-Jul-10 16:12 
There are a number of ways to do this. The easiest way is to create a custom UserControl with a custom event.

public partial class MyUserControl : UserControl
{
    public event EventHandler TheButtonWasClick;

    public MyUserControl()
    {
        InitializeComponent();
        //register the "button1_Click" method as a listener..
        button1.Click += new EventHandler(button1_Click);
    }

    private void button1_Click(object sender, EventArgs e)
    {
        //the event will be null if it has no listeners...
        if (TheButtonWasClick != null)
            TheButtonWasClick(this, EventArgs.Empty);
    }
}



Now in your main form you wire up your custom UserControl...


public partial class MainForm : Form
{
    private void mainFormButton_Click(object sender, EventArgs e)
    {
        MyUserControl myUserControl = new MyUserControl();
        //register the "myUserControl_TheButtonWasClick" as a listener...
        myUserControl.TheButtonWasClick += new EventHandler(myUserControl_TheButtonWasClick);
    }

    void myUserControl_TheButtonWasClick(object sender, EventArgs e)
    {
        //execute your code when the button is clicked...
    }
}


Does this help you?
The mind is like a parachute. It doesn’t work unless it’s open.

GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
JessStuart14-Jul-10 6:51
JessStuart14-Jul-10 6:51 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
Richard Blythe14-Jul-10 7:40
Richard Blythe14-Jul-10 7:40 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
JessStuart14-Jul-10 8:07
JessStuart14-Jul-10 8:07 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
Richard Blythe14-Jul-10 8:28
Richard Blythe14-Jul-10 8:28 
QuestionPlaying mp3 files?? Pin
Muammar©13-Jul-10 7:11
Muammar©13-Jul-10 7:11 
AnswerRe: Playing mp3 files?? Pin
I Believe In GOD13-Jul-10 7:39
I Believe In GOD13-Jul-10 7:39 
GeneralRe: Playing mp3 files?? Pin
Muammar©13-Jul-10 10:18
Muammar©13-Jul-10 10:18 
GeneralRe: Playing mp3 files?? Pin
Muammar©13-Jul-10 10:23
Muammar©13-Jul-10 10:23 
GeneralRe: Playing mp3 files?? Pin
harold aptroot13-Jul-10 10:38
harold aptroot13-Jul-10 10:38 
GeneralRe: Playing mp3 files?? Pin
Muammar©13-Jul-10 19:22
Muammar©13-Jul-10 19:22 
GeneralRe: Playing mp3 files?? Pin
Ravi Bhavnani13-Jul-10 11:43
professionalRavi Bhavnani13-Jul-10 11:43 
Questionsocket programming Pin
shaghyegh13-Jul-10 6:15
shaghyegh13-Jul-10 6:15 
AnswerRe: socket programming Pin
Abhinav S13-Jul-10 6:37
Abhinav S13-Jul-10 6:37 
QuestionHow to read attachment content using X-MS-ENUMATTS Method Pin
meeram39513-Jul-10 5:46
meeram39513-Jul-10 5:46 
QuestionMessage Removed Pin
13-Jul-10 5:40
Shahzad.Aslam13-Jul-10 5:40 
AnswerRe: Passing parameters from Other Application to .Net Pin
OriginalGriff13-Jul-10 5:45
mveOriginalGriff13-Jul-10 5:45 
GeneralMessage Removed Pin
13-Jul-10 6:25
Shahzad.Aslam13-Jul-10 6:25 

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.