Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: store datagridview items under a button [modified] Need help! Pin
Member 474292220-Aug-09 2:08
Member 474292220-Aug-09 2:08 
GeneralRe: store datagridview items under a button [modified] Need help! Pin
OriginalGriff20-Aug-09 9:16
mveOriginalGriff20-Aug-09 9:16 
GeneralRe: store datagridview items under a button [modified] Need help! Pin
Member 474292220-Aug-09 21:38
Member 474292220-Aug-09 21:38 
GeneralRe: store datagridview items under a button [modified] Need help! Pin
OriginalGriff20-Aug-09 21:52
mveOriginalGriff20-Aug-09 21:52 
GeneralRe: store datagridview items under a button [modified] Need help! Pin
Member 474292222-Aug-09 2:08
Member 474292222-Aug-09 2:08 
QuestionGeneric Question - Implementing IEnumerable Pin
Programm3r19-Aug-09 23:37
Programm3r19-Aug-09 23:37 
AnswerRe: Generic Question - Implementing IEnumerable Pin
N a v a n e e t h20-Aug-09 0:08
N a v a n e e t h20-Aug-09 0:08 
GeneralRe: Generic Question - Implementing IEnumerable Pin
Programm3r20-Aug-09 1:40
Programm3r20-Aug-09 1:40 
AnswerRe: Generic Question - Implementing IEnumerable Pin
Nicholas Butler20-Aug-09 0:10
sitebuilderNicholas Butler20-Aug-09 0:10 
GeneralRe: Generic Question - Implementing IEnumerable Pin
Programm3r20-Aug-09 2:06
Programm3r20-Aug-09 2:06 
QuestionWhy doesn´t work the Code? Pin
nhqlbaislwfiikqraqnm19-Aug-09 22:48
nhqlbaislwfiikqraqnm19-Aug-09 22:48 
AnswerRe: Why doesn´t work the Code? Pin
padmanabhan N19-Aug-09 22:59
padmanabhan N19-Aug-09 22:59 
GeneralRe: Why doesn´t work the Code? Pin
nhqlbaislwfiikqraqnm19-Aug-09 23:05
nhqlbaislwfiikqraqnm19-Aug-09 23:05 
GeneralRe: Why doesn´t work the Code? Pin
padmanabhan N19-Aug-09 23:15
padmanabhan N19-Aug-09 23:15 

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.