Click here to Skip to main content
15,906,558 members
Home / Discussions / C#
   

C#

 
QuestionGrid Platform Pin
satsumatable20-Aug-09 0:43
satsumatable20-Aug-09 0:43 
AnswerRe: Grid Platform Pin
stancrm20-Aug-09 0:59
stancrm20-Aug-09 0:59 
QuestionHow to put focus (with keyboard shortcuts) on input fields in Visual Studio Express C#? Pin
pietlut20-Aug-09 0:41
pietlut20-Aug-09 0:41 
AnswerRe: How to put focus (with keyboard shortcuts) on input fields in Visual Studio Express C#? Pin
OriginalGriff20-Aug-09 0:59
mveOriginalGriff20-Aug-09 0:59 
GeneralRe: How to put focus (with keyboard shortcuts) on input fields in Visual Studio Express C#? Pin
pietlut20-Aug-09 6:21
pietlut20-Aug-09 6:21 
QuestionLines Disappear Pin
mgroses20-Aug-09 0:04
mgroses20-Aug-09 0:04 
AnswerRe: Lines Disappear Pin
Christian Graus20-Aug-09 0:06
protectorChristian Graus20-Aug-09 0:06 
GeneralRe: Lines Disappear Pin
mgroses20-Aug-09 0:16
mgroses20-Aug-09 0:16 
AnswerRe: Lines Disappear Pin
DaveyM6920-Aug-09 0:14
professionalDaveyM6920-Aug-09 0:14 
AnswerRe: Lines Disappear Pin
mgroses20-Aug-09 0:22
mgroses20-Aug-09 0:22 
GeneralRe: Lines Disappear Pin
Christian Graus20-Aug-09 0:26
protectorChristian Graus20-Aug-09 0:26 
QuestionLoad text from webpage Pin
valdo11120-Aug-09 0:01
valdo11120-Aug-09 0:01 
AnswerRe: Load text from webpage Pin
Christian Graus20-Aug-09 0:04
protectorChristian Graus20-Aug-09 0:04 
AnswerRe: Load text from webpage Pin
N a v a n e e t h20-Aug-09 0:13
N a v a n e e t h20-Aug-09 0:13 
GeneralRe: Load text from webpage Pin
valdo11120-Aug-09 0:31
valdo11120-Aug-09 0:31 
Questionbool delegate Pin
bonzaiholding19-Aug-09 23:59
bonzaiholding19-Aug-09 23:59 
AnswerRe: bool delegate Pin
Christian Graus20-Aug-09 0:05
protectorChristian Graus20-Aug-09 0:05 
AnswerRe: bool delegate Pin
N a v a n e e t h20-Aug-09 0:11
N a v a n e e t h20-Aug-09 0:11 
AnswerRe: bool delegate Pin
DaveyM6920-Aug-09 0:11
professionalDaveyM6920-Aug-09 0:11 
GeneralRe: bool delegate Pin
bonzaiholding20-Aug-09 0:36
bonzaiholding20-Aug-09 0:36 
GeneralRe: bool delegate Pin
DaveyM6920-Aug-09 1:38
professionalDaveyM6920-Aug-09 1:38 
GeneralRe: bool delegate Pin
DaveyM6920-Aug-09 1:52
professionalDaveyM6920-Aug-09 1:52 
You could pass a parameter and check that in each handler:
using System;
using System.Windows.Forms;

public partial class Form1 : Form
{
    TestClass testClass;

    public Form1()
    {

        InitializeComponent();
        testClass = new TestClass();
        testClass.TestEvent += new EventHandler<TestEventArgs>(testClass_TestEvent);
        testClass.TestEvent += new EventHandler<TestEventArgs>(testClass_TestEvent);
        Shown += new EventHandler(Form1_Shown);
    }

    void Form1_Shown(object sender, EventArgs e)
    {
        testClass.PerformTest();
    }

    void testClass_TestEvent(object sender, TestEventArgs e)
    {
        if (e.TestBool != true)
        {
            e.TestBool = true;
            MessageBox.Show("Changed to true");
        }
        else
        {
            MessageBox.Show("Already true");
        }
    }
}
public class TestClass
{
    public event EventHandler<TestEventArgs> TestEvent;

    protected virtual void OnTestEvent(TestEventArgs e)
    {
        EventHandler<TestEventArgs> eh = TestEvent;
        if (eh != null)
            eh(this, e);
    }

    public void PerformTest()
    {
        OnTestEvent(new TestEventArgs());
    }
}

public class TestEventArgs : EventArgs
{
    public bool TestBool
    {
        get;
        set;
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: bool delegate Pin
bonzaiholding20-Aug-09 2:40
bonzaiholding20-Aug-09 2:40 
Generalstore datagridview items under a button [modified] Need help! Pin
Member 474292219-Aug-09 23:43
Member 474292219-Aug-09 23:43 
GeneralRe: store datagridview items under a button [modified] Need help! Pin
OriginalGriff20-Aug-09 1:40
mveOriginalGriff20-Aug-09 1:40 

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.