Click here to Skip to main content
15,867,860 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys im new in coding and got an quick question hope anyone can help me PLEASE or post something usefull.

is it possible to use this code only with the ckeckbox i mean if checkbox checked enable this code and if checkbox changed disable it.

C#
private void button18_Click_1(object sender, EventArgs e)
{
    var pulse = new Thread(health);
    pulse.Start();
}

private void health()
{
    do
    {
        _rtm.Poke(0xbE238DD4, "00003A7E");
        if (checkBox1.Checked) Thread.Sleep(500);
    } while (checkBox1.Checked);
    status.Text = "Inf Health Enabled";
}
Posted

There are two ways to do it:
1) Add code to the Click event handler which looks at your CheckBox.Checked property, and continues only if it is:
C#
private void button18_Click_1(object sender, EventArgs e)
{
    if (myCheckBox.Checked)
    {
        var pulse = new Thread(health);
        Pulse.Start();
    }
}

2) Disable the button by handling the CheckBox.CheckChanged event:
C#
private void myCheckBox_CheckedChanged(object sender, EventArgs e)
{
    button1.Enabled = myCheckBox.Checked;
}
 
Share this answer
 
thank you, but not exacty that i want.

hmm i want send this code _rtm.Poke(0xbE238DD4, "00003A7E"); permant (like an loop command) using only an checkbox,


edit:

the code i posted is working great as an loop command to send the rtm.poke code
but i will use only the checkbox
 
Share this answer
 
v2
Comments
Thomas Daniels 9-Dec-12 11:18am    
If you've a comment to an answer, click on the "Have a Question or Comment?" button, but don't post a comment as an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900