Page 1 of 3 123 LastLast
Results 1 to 15 of 39

Hybrid View

  1. #1
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed

    c# checkbox-var_click instead of button1_click

    Is it possible to do some looping that checks multiple checkboxes after eachother

    like:

    Code:
    for(int B = 1 , 18 , B--)
    {
    if(checkboxB = true)
    {
    writeInteger(0xadress + 0x((B-1)*OFFSET);
    }
    }
    ?
    Last edited by stevonator; 08-09-2012 at 12:54 PM.

  2. #2
          ( ° ͜ʖ͡°)╭∩╮
    Former Staff
    MarkHC's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    127.0.0.1
    Posts
    2,750
    Reputation
    66
    Thanks
    14,529
    My Mood
    Angelic
    Just create an array of CheckBoxes Then use the loop...

    Code:
    if(CheckBox[i].IsChecked)
         //Do yourz stuffz here :P


    CoD Minion from 09/19/2012 to 01/10/2013

  3. The Following User Says Thank You to MarkHC For This Useful Post:

    stevonator (08-09-2012)

  4. #3
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    So instead of the B it's [i] , ok thx, i'll try it when i have time

    I just need this because if i didn't use it i should hardcode 152 checkboxes xD long live loops

  5. #4
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,112
    My Mood
    Angelic
    Quote Originally Posted by stevonator View Post
    Is it possible to do some looping that checks multiple checkboxes after eachother

    like:

    Code:
    for(int B = 1 , 18 , B--)
    {
    if(checkboxB = true)
    {
    writeInteger(0xadress + 0x((B-1)*OFFSET);
    }
    }
    ?
    Like this:
    Code:
    void Loop_CheckBoxses()
            {
                foreach (Control C in this.Controls)//Loops over all the controls in the Form1 (this = The Form)
                {
                    if (C is CheckBox)//Checks if the C (Control) is an CheckBox
                    {
                        CheckBox CheckBoxC = C as CheckBox; //We "create" a checkbox of the Control C (We do this to have the funtions of the CheckBox)
                        if (CheckBoxC.Checked) //Checks if the Checbox is checked
                        {
                            //Do your actions here
                        }
                    }
                }
            }
    Here is my Tip:
    Code:
            void Loop_CheckBoxses()
            {
                int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            Loop_SubHack(Loops);
                        }
                        Loops++;
                    }
                }
            }
    
            void Loop_SubHack(int Loop)
            {
                //Switch/Case Statement
                //This is recommended if you want an easy view over your codes.
                //NOTE: You need to write 1 line extra tho.. (break;) instead of the IFs
                switch (Loop)
                {
                    case 0:
                        MessageBox.Show("Write your Integer here", "0");
                        break;
                    case 1:
                        MessageBox.Show("Write your Integer here", "1");
                        break;
                }
    
                //OR use the IF statement...
                //Easy usage, but not that good over-view
                if(Loop == 0)
                    MessageBox.Show("Write your Integer here", "0");
                if(Loop  == 1)
                    MessageBox.Show("Write your Integer here", "1");
            }
    Last edited by Jorndel; 08-10-2012 at 05:36 AM.

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  6. #5
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    Quote Originally Posted by Jorndel View Post


    Like this:
    Code:
    void Loop_CheckBoxses()
            {
                foreach (Control C in this.Controls)//Loops over all the controls in the Form1 (this = The Form)
                {
                    if (C is CheckBox)//Checks if the C (Control) is an CheckBox
                    {
                        CheckBox CheckBoxC = C as CheckBox; //We "create" a checkbox of the Control C (We do this to have the funtions of the CheckBox)
                        if (CheckBoxC.Checked) //Checks if the Checbox is checked
                        {
                            //Do your actions here
                        }
                    }
                }
            }
    Here is my Tip:
    Code:
            void Loop_CheckBoxses()
            {
                int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            Loop_SubHack(Loops);
                        }
                        Loops++;
                    }
                }
            }
    
            void Loop_SubHack(int Loop)
            {
                //Switch/Case Statement
                //This is recommended if you want an easy view over your codes.
                //NOTE: You need to write 1 line extra tho.. (break;) instead of the IFs
                switch (Loop)
                {
                    case 0:
                        MessageBox.Show("Write your Integer here", "0");
                        break;
                    case 1:
                        MessageBox.Show("Write your Integer here", "1");
                        break;
                }
    
                //OR use the IF statement...
                //Easy usage, but not that good over-view
                if(Loop == 0)
                    MessageBox.Show("Write your Integer here", "0");
                if(Loop  == 1)
                    MessageBox.Show("Write your Integer here", "1");
            }
    so in my case, does this code makes sense...? (Loops is the number of checkboxes it's currently at..?)

    Code:
     void Loop_CheckBoxses()
            {
                int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            Loop_SubHack(Loops);
                        }
                        Loops++;
                    }
                }
            }
    
            void Loop_SubHack(int Loop)
            {
                if(Loop >= 0 & Loop <= 17)
                    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
                if(Loop >= 18 & Loop <= 35)
                    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
                ...etc etc etc
            }

  7. #6
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,112
    My Mood
    Angelic
    Quote Originally Posted by stevonator View Post
    so in my case, does this code makes sense...? (Loops is the number of checkboxes it's currently at..?)

    Code:
     void Loop_CheckBoxses()
            {
                int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            Loop_SubHack(Loops);
                        }
                        Loops++;
                    }
                }
            }
    
            void Loop_SubHack(int Loop)
            {
                if(Loop >= 0 & Loop <= 17)
                    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
                if(Loop >= 18 & Loop <= 35)
                    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
                ...etc etc etc
            }
    Indeed

    Or you can just short your code even more
    Code:
    void Loop_CheckBoxses()
            {
                int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
    if(Loop >= 0 & Loop <= 17)
    {
    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
    }
    if(Loop >= 18 & Loop <= 35)
    {
    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
    }
                        }
                        Loops++;
                    }
                }
            }

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  8. #7
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    Quote Originally Posted by Jorndel View Post


    Indeed

    Or you can just short your code even more
    Code:
    void Loop_CheckBoxses()
            {
                int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
    if(Loop >= 0 & Loop <= 17)
    {
    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
    }
    if(Loop >= 18 & Loop <= 35)
    {
    writeInteger(0x address + (0x (int.parse(Loop)*OFFSET)), value)
    }
                        }
                        Loops++;
                    }
                }
            }
    ok i see, thanks a lot, i'll try it tommorow (cause now i can't go on my laptop :/ ) but thanks, credits for code help go to several people, like you

    EDIT: so if all goes well, this should only write to the byte when the checkbox is checked and when the loopnumber is correct...

    and the checkboxes check in order... so it begins with checkbox1,2,3,4,...
    Last edited by stevonator; 08-10-2012 at 10:32 AM.

  9. #8
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,112
    My Mood
    Angelic
    Quote Originally Posted by stevonator View Post
    ok i see, thanks a lot, i'll try it tommorow (cause now i can't go on my laptop :/ ) but thanks, credits for code help go to several people, like you

    EDIT: so if all goes well, this should only write to the byte when the checkbox is checked and when the loopnumber is correct...

    and the checkboxes check in order... so it begins with checkbox1,2,3,4,...
    Maybe :S

    You just have to try :P

    Else just check the name (Unless you changed the names...)
    And check if it contains like: Checkbox1 (1)
    And then see if it's within the Range

    If you need some help in that:
    (Code free hand)

    string NumCheck = CheckBoxC.Name.Replace("CheckBox", "");
    Code:
    void Loop_CheckBoxses()
            {
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
    int NumCheck = int.Parse(CheckBoxC.Name.Replace("CheckBox", ""));
    if(NumCheck >= 0 & NumCheck <= 17)
    {
    writeInteger(0x address + (0x (int.parse(NumCheck)*OFFSET)), value)
    }
    if(NumCheck >= 18 & NumCheck <= 35)
    {
    writeInteger(0x address + (0x (int.parse(NumCheck)*OFFSET)), value)
    }
                        }
                    }
                }
            }


    Means I just removed the name of the checkbox (default name)
    and is left with only the number value.
    And then I compare that with the check you have

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  10. #9
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    ok thx

    i actually made a mistake, for the 2nd if statement i have to do the int.parse minus 18 (18 players, so the first checkbox would start again with player 1 instead of with player 19)

  11. #10
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,112
    My Mood
    Angelic
    Quote Originally Posted by stevonator View Post
    ok thx

    i actually made a mistake, for the 2nd if statement i have to do the int.parse minus 18 (18 players, so the first checkbox would start again with player 1 instead of with player 19)
    Don't get what you mean but :P
    Solved or?

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  12. #11
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,920
    Reputation
    574
    Thanks
    5,050
    My Mood
    Twisted
    Quote Originally Posted by Jorndel View Post


    Don't get what you mean but :P
    Solved or?
    I think he just pointed it out, that the raw code he posted wouldnt work cus it had to return to 1 after 18
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  13. The Following User Says Thank You to Horror For This Useful Post:

    Jorndel (08-10-2012)

  14. #12
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    Quote Originally Posted by Isaakske View Post
    I think he just pointed it out, that the raw code he posted wouldnt work cus it had to return to 1 after 18
    yes
    cause if i do (example: ammo) with address+(18*OFFSET)
    and there's no ammo for player 19... so i do have to return to 0 every time

    ps: how long would a loop through 144 checkboxes/radiobuttons take?

  15. #13
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,920
    Reputation
    574
    Thanks
    5,050
    My Mood
    Twisted
    Quote Originally Posted by stevonator View Post
    yes
    cause if i do (example: ammo) with address+(18*OFFSET)
    and there's no ammo for player 19... so i do have to return to 0 every time

    ps: how long would a loop through 144 checkboxes/radiobuttons take?
    a few milliseconds ? depends on the PC ur using ofcourse ... But seriously, in the blink of an eye ...
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  16. #14
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    sorry for double post

    this code doesn't do anything, i check 1 checkbox (1st one) and this code:

    Code:
      private void button2_Click(object sender, EventArgs e)
            {
               int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            if(Loops >= 0 & Loops <= 17)
                                {
                                    MessageBox.Show("between 0 and 17");
                                }
                            if(Loops >= 18 & Loops <= 35)
                                {
                                    MessageBox.Show("between 18 and 35");
                                }
                        }
                        Loops++;
                    }
                }
    and it doesn't do anything when any of those checkboxes is checked and i click the button
    Last edited by stevonator; 08-11-2012 at 04:43 AM.

  17. #15
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,112
    My Mood
    Angelic
    Quote Originally Posted by stevonator View Post
    sorry for double post

    this code doesn't do anything, i check 1 checkbox (1st one) and this code:

    Code:
      private void button2_Click(object sender, EventArgs e)
            {
               int Loops = 0;
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            if(Loops >= 0 & Loops <= 17)
                                {
                                    MessageBox.Show("between 0 and 17");
                                }
                            if(Loops >= 18 & Loops <= 35)
                                {
                                    MessageBox.Show("between 18 and 35");
                                }
                        }
                        Loops++;
                    }
                }
    and it doesn't do anything when any of those checkboxes is checked and i click the button
    Are you sure you search the right controls?
    So you don't use like a TabControl* | panel or such?

    ______________
    Form1:

    Code:
    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                foreach (Control C in this.Controls)
                {
                    if (C is CheckBox)
                    {
                        CheckBox CheckBoxC = C as CheckBox;
                        if (CheckBoxC.Checked)
                        {
                            int Che = int.Parse(CheckBoxC.Name.Replace("checkBox", ""));
                            if (Che >= 0 & Che <= 5)
                            {
                                MessageBox.Show("between 0 and 5");
                            }
                            if (Che >= 6 & Che <= 11)
                            {
                                MessageBox.Show("between 6 and 11");
                            }
                        }
                    }
                }
            }
    I use the Replacing of the Default Name to ensure I get the right checbox.
    I know it go from the last control sometimes. (Total random :P)

    If you have it on a panel do so:
    Code:
     foreach (Control C in panel1.Controls)
    Last edited by Jorndel; 08-11-2012 at 10:05 AM.

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

Page 1 of 3 123 LastLast

Similar Threads

  1. Checkboxes
    By Offbeat Ninja in forum C++/C Programming
    Replies: 0
    Last Post: 07-02-2008, 05:19 PM
  2. How to make checkboxes for vb6 for Warrock
    By Desymondo in forum Visual Basic Programming
    Replies: 1
    Last Post: 10-21-2007, 05:49 PM
  3. how to make checkboxes for vb6 for warrock
    By Desymondo in forum WarRock - International Hacks
    Replies: 3
    Last Post: 10-21-2007, 10:52 AM
  4. How to bypass Xtrap ? Then Use Actool instead of KoxP !
    By kcetinkaya in forum Knight Online Hacks
    Replies: 2
    Last Post: 07-18-2007, 07:01 PM
  5. [Tutorial] VB Checkboxes/Superjump/Pointers/Password Protection
    By mains3rv3r in forum WarRock - International Hacks
    Replies: 26
    Last Post: 06-29-2007, 01:17 AM