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

    Question button press loop

    is it possible to do something like:


    Code:
        
             for(int i = 1 , i != 5 , i++)
    {
             private void checkBox[i]_CheckedChanged(object sender, EventArgs e)
            {
                code...
            }
    }

  2. #2
    Eidolon's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Vanished
    Posts
    822
    Reputation
    54
    Thanks
    4,077
    My Mood
    Angelic
    Only like this
    Code:
    {
             private void checkBox[i]_CheckedChanged(object sender, EventArgs e)
            {
                for(int i = 0 , i < 5 , i++)
                //code...
            }
    }




    Yet, you are a pathetic human.

    Contributor since: 7.26.2012 - ended
    Donator since: 7.14.2012


  3. #3
    stevonator's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    83
    Reputation
    10
    Thanks
    144
    My Mood
    Stressed
    Quote Originally Posted by Anonymouss View Post
    Only like this
    Code:
    {
             private void checkBox[i]_CheckedChanged(object sender, EventArgs e)
            {
                for(int i = 0 , i < 5 , i++)
                //code...
            }
    }
    ok thanks

    i don't want to hardcode stuff so i can use those noob tips (i'm the noob, so the tip is meant for noobs, cause you're pro xD )

    EDIT: hmmm doesn't work, does is still has to be triggered like something? cause that's not the meaning of it...
    Last edited by stevonator; 08-16-2012 at 08:34 AM.

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

    i don't want to hardcode stuff so i can use those noob tips (i'm the noob, so the tip is meant for noobs, cause you're pro xD )

    EDIT: hmmm doesn't work, does is still has to be triggered like something? cause that's not the meaning of it...
    Select all the checboxses
    Go to the events and create the changedchanged event thing.
    Do the event there.

    Note: You need to think a little bit about how to do it.
    It's not as easy as I make it sound :P
    (I did this once, but then I used a loop for a check. As I showed you earlier in another thread...)

     
    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

  5. #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


    Select all the checboxses
    Go to the events and create the changedchanged event thing.
    Do the event there.

    Note: You need to think a little bit about how to do it.
    It's not as easy as I make it sound :P
    (I did this once, but then I used a loop for a check. As I showed you earlier in another thread...)
    euhm.. ok xD

    i'll try it day after tommorow, cause i can most of the time only play every 2 days :/

  6. #6
    Eidolon's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Vanished
    Posts
    822
    Reputation
    54
    Thanks
    4,077
    My Mood
    Angelic
    Code:
    {
             private void checkBox[i]_CheckedChanged(object sender, EventArgs e)
            {
                //Initialize a temporary integer for the loop count. You loop 5 times. Thereafter you stop looping. it gets triggered by pressing the button
                for(int i = 0 , i < 5 , i++)
                //code...
            }
    }




    Yet, you are a pathetic human.

    Contributor since: 7.26.2012 - ended
    Donator since: 7.14.2012


  7. #7
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    Well depends on what it will do

    you have as shown:

    Code:
    for(int Integer = 0; Integer != 10; Integer++)
    for = Doing something for...
    int Integer = 0 = Creates an integer that holds the value 0
    Integer != 10 = Will do the for aslong as Integer is NOT equal to 10
    Integer++ = Increase the Integers value with one each time it finish the for (loop)

    Code:
    while(Value)
    while = Do something while the value is not true/false
    Value = the value it will use to check.

    Like:
    Code:
    int i = 0;
    while(i != 10)
    i++;
    Last edited by Jorndel; 08-17-2012 at 09:37 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

  8. #8
    Eidolon's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Vanished
    Posts
    822
    Reputation
    54
    Thanks
    4,077
    My Mood
    Angelic
    Quote Originally Posted by Jorndel View Post
    Code:
    int i = 0;
    while(i != 10)
    i++;
    .... Are you serious?
    Code:
    for(int i = 0; i < 10; i++)
    Is just the same

    Code:
    char answer = 'y';
    while(answer = 'y'){
    cout << "Answer is yes" << endl;
    cin >> answer;}
    is more like a while
    Last edited by Eidolon; 08-17-2012 at 11:06 AM.




    Yet, you are a pathetic human.

    Contributor since: 7.26.2012 - ended
    Donator since: 7.14.2012


  9. #9
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    Quote Originally Posted by Anonymouss View Post


    .... Are you serious?
    Code:
    for(int i = 0; i < 10; i++)
    Is just the same

    Code:
    char answer = 'y';
    while(answer = 'y'){
    cout << "Answer is yes" << endl;
    cin >> answer;}
    is more like a while
    X,x
    Seems you need to studdy a bit more on that :|
    Was just an example on HOW he could use a while loop.
    For all I care he can use a bool as the while value...

    It's all about helping the user to understand what the code does.
    And not just give them a code and say: Do that or put that there.
    Then he would maybe have to ask us again for this in 4 weeks or so...

    It's more about the user-focuse rather then the expertise of the answer. (That helps as well)
    But having a noob telling you how to do it instead of a geek.
    Some MIGHT not understand a geeky way but the nooby way is more on his level.

    Or who ever that needs help.

     
    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. The Following User Says Thank You to Jorndel For This Useful Post:

    Eidolon (08-17-2012)

Similar Threads

  1. Cycling through threads on button press
    By Azureum in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 0
    Last Post: 09-06-2010, 12:55 AM
  2. [CODE] Button Pressed[Solved]
    By Golden. in forum Visual Basic Programming
    Replies: 16
    Last Post: 07-28-2010, 09:29 PM
  3. >Tutorial< How to press a button from form1 ON form2! (Useful)
    By Zoom in forum Visual Basic Programming
    Replies: 6
    Last Post: 11-13-2009, 02:54 PM
  4. i pressed the back button sorry
    By brownsfan91 in forum WarRock Korea Hacks
    Replies: 7
    Last Post: 12-03-2007, 09:20 PM
  5. i pressed the back button sorry
    By brownsfan91 in forum WarRock Korea Hacks
    Replies: 0
    Last Post: 11-30-2007, 06:13 PM