Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
GeneralRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Ashfield14-Aug-09 5:05
Ashfield14-Aug-09 5:05 
QuestionDisabling a button on one form from another. Pin
False Chicken14-Aug-09 0:28
False Chicken14-Aug-09 0:28 
AnswerRe: Disabling a button on one form from another. Pin
DaveyM6914-Aug-09 0:53
professionalDaveyM6914-Aug-09 0:53 
AnswerRe: Disabling a button on one form from another. Pin
DaveyM6914-Aug-09 1:00
professionalDaveyM6914-Aug-09 1:00 
GeneralRe: Disabling a button on one form from another. Pin
False Chicken14-Aug-09 1:06
False Chicken14-Aug-09 1:06 
AnswerRe: Disabling a button on one form from another. Pin
Hristo-Bojilov14-Aug-09 1:08
Hristo-Bojilov14-Aug-09 1:08 
GeneralRe: Disabling a button on one form from another. Pin
False Chicken14-Aug-09 1:15
False Chicken14-Aug-09 1:15 
GeneralRe: Disabling a button on one form from another. Pin
DaveyM6914-Aug-09 1:39
professionalDaveyM6914-Aug-09 1:39 
Working Example:
// FormButton.cs
using System;
using System.Windows.Forms;

public partial class FormButton : Form
{
    public FormButton()
    {
        InitializeComponent();
    }

    private void FormButton_Load(object sender, EventArgs e)
    {
        FormCheckBox formCheckBox = new FormCheckBox();
        formCheckBox.CheckStateChanged += formCheckBox_CheckStateChanged;
        formCheckBox.Show();
    }

    void formCheckBox_CheckStateChanged(object sender, CheckStateEventArgs e)
    {
        button1.Enabled = e.IsChecked;
    }
}
// FormCheckBox.cs
using System;
using System.Windows.Forms;

public partial class FormCheckBox : Form
{
    public event EventHandler<CheckStateEventArgs> CheckStateChanged;
    public FormCheckBox()
    {
        InitializeComponent();
    }

    private void checkBox1_CheckStateChanged(object sender, EventArgs e)
    {
        OnCheckStateChanged(new CheckStateEventArgs(checkBox1.Checked));
    }

    protected virtual void OnCheckStateChanged(CheckStateEventArgs e)
    {
        EventHandler<CheckStateEventArgs> eh = CheckStateChanged;
        if (eh != null)
            eh(this, e);
    }
}
// CheckStateEventArgs.cs
public class CheckStateEventArgs : EventArgs
{
    public CheckStateEventArgs(bool isChecked)
    {
        IsChecked = isChecked;
    }
    public bool IsChecked
    {
        get;
        private 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: Disabling a button on one form from another. Pin
Hristo-Bojilov14-Aug-09 2:01
Hristo-Bojilov14-Aug-09 2:01 
QuestionDelegateSerializationHolder is not permitted to be deserialized at this security level Pin
Nigel Mackay14-Aug-09 0:08
Nigel Mackay14-Aug-09 0:08 
AnswerRe: DelegateSerializationHolder is not permitted to be deserialized at this security level Pin
Hristo-Bojilov14-Aug-09 7:46
Hristo-Bojilov14-Aug-09 7:46 
GeneralRe: DelegateSerializationHolder is not permitted to be deserialized at this security level Pin
Nigel Mackay14-Aug-09 21:27
Nigel Mackay14-Aug-09 21:27 
Question'Mirror' ListView control Pin
kanchoette13-Aug-09 23:48
kanchoette13-Aug-09 23:48 
AnswerRe: 'Mirror' ListView control Pin
musefan14-Aug-09 2:33
musefan14-Aug-09 2:33 
QuestionCatching an Exception Pin
stancrm13-Aug-09 23:47
stancrm13-Aug-09 23:47 
AnswerRe: Catching an Exception Pin
Eddy Vluggen14-Aug-09 0:07
professionalEddy Vluggen14-Aug-09 0:07 
GeneralRe: Catching an Exception Pin
stancrm14-Aug-09 1:15
stancrm14-Aug-09 1:15 
QuestionClose Firefox with C# Pin
nhqlbaislwfiikqraqnm13-Aug-09 22:35
nhqlbaislwfiikqraqnm13-Aug-09 22:35 
AnswerRe: Close Firefox with C# Pin
Eddy Vluggen13-Aug-09 22:39
professionalEddy Vluggen13-Aug-09 22:39 
AnswerRe: Close Firefox with C# Pin
Rajesh R Subramanian13-Aug-09 22:42
professionalRajesh R Subramanian13-Aug-09 22:42 
GeneralRe: Close Firefox with C# Pin
nhqlbaislwfiikqraqnm13-Aug-09 22:51
nhqlbaislwfiikqraqnm13-Aug-09 22:51 
GeneralRe: Close Firefox with C# Pin
0x3c013-Aug-09 22:54
0x3c013-Aug-09 22:54 
GeneralRe: Close Firefox with C# Pin
nhqlbaislwfiikqraqnm13-Aug-09 22:59
nhqlbaislwfiikqraqnm13-Aug-09 22:59 
GeneralRe: Close Firefox with C# Pin
Eddy Vluggen13-Aug-09 23:14
professionalEddy Vluggen13-Aug-09 23:14 
GeneralRe: Close Firefox with C# Pin
nhqlbaislwfiikqraqnm13-Aug-09 23:41
nhqlbaislwfiikqraqnm13-Aug-09 23:41 

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.