Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring

    Thumbs up How To Use One Button For [OFF] & [ON] - C#

    Seeing that nearly every one posting in the release section is using two buttons, one for ON the other for OFF... Well time you learn how to use one button...

    Here is the GUI

    Before

    After


    Hmm you must be thinking this must be very easy!
    Correct!

    Here is how you do it...


    What would happen if you changed the "else if" to "if"...
    Well you would get both MessageBoxe's showing from just clicking once
    Some of you may be saying.. hey I know another way!
    Good on ya, then use it!
    This is a simple way and what I use

    I hope to see in all of the people that needed this to see it used in your next release


    ---
    Q: Why is it an image?
    A: Yuno type yo self? y u wona copy n paste? yuno learn? reading will help you understand it, that's why you copy crap from the board at school
    Last edited by NadeHouse; 10-30-2012 at 01:16 AM. Reason: Left out an image D:





  2. The Following User Says Thank You to NadeHouse For This Useful Post:

    Skinksteek (11-16-2012)

  3. #2
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    But....isn't this common sense? :O

  4. #3
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring
    Quote Originally Posted by Kenshin13 View Post
    But....isn't this common sense? :O
    Then why is most peoples releases using two buttons





  5. #4
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by NadeHouse View Post
    Then why is most peoples releases using two buttons
    ...Guess we just got brains then.

  6. #5
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring
    Quote Originally Posted by Kenshin13 View Post
    ...Guess we just got brains then.
    I suppose in that case :P but seems you are on hallucinogens he





  7. The Following User Says Thank You to NadeHouse For This Useful Post:

    Kenshin13 (10-30-2012)

  8. #6
    Violence begets violence, so why give it back?
    MPGH Member
    Skinksteek's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    In a Care Package
    Posts
    497
    Reputation
    30
    Thanks
    623
    My Mood
    Angelic
    Thanks.
    Made by @Jorndel


    [IMG]https://www.danasof*****m/sig/Trololol132237.jpg[/IMG]


    Leecher: 0 []
    Choob: 25 []
    Newbie: 50 []
    Member: 100 []
    Advanced Member: 150 []
    Dual-Keyboard Member: 250 []
    Expert Member: 500 []
    Bobo's Trainer: 750 [X]
    MPGH Expert: 1000 [X]
    Synthetic Hacker: 1250 [X]
    Blackhat Hacker: 1500 [X]
    Whitehat Hacker: 2000 [X]
    Bobo's Guardian: 2500 [X]
    Upcoming MPGHiean: 3000 [X]
    MPGH Addict: 3500 [X]
    MPGHiean: 4000 [X]
    MPGH Knight: 4500 [X]
    MPGH Lord: 5000 [X]
    MPGH Champion: 5500 [X]
    MPGH King: 6000 [X]
    "Wish me a good luck."

  9. The Following User Says Thank You to Skinksteek For This Useful Post:

    NadeHouse (10-30-2012)

  10. #7
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring
    Quote Originally Posted by Skinksteek View Post
    Thanks.
    Glad it helped one person

    Check out the tutorial on the login screen if interested





  11. #8
    Violence begets violence, so why give it back?
    MPGH Member
    Skinksteek's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    In a Care Package
    Posts
    497
    Reputation
    30
    Thanks
    623
    My Mood
    Angelic
    Quote Originally Posted by NadeHouse View Post
    Glad it helped one person

    Check out the tutorial on the login screen if interested
    Ofcourse, where is it?
    Made by @Jorndel


    [IMG]https://www.danasof*****m/sig/Trololol132237.jpg[/IMG]


    Leecher: 0 []
    Choob: 25 []
    Newbie: 50 []
    Member: 100 []
    Advanced Member: 150 []
    Dual-Keyboard Member: 250 []
    Expert Member: 500 []
    Bobo's Trainer: 750 [X]
    MPGH Expert: 1000 [X]
    Synthetic Hacker: 1250 [X]
    Blackhat Hacker: 1500 [X]
    Whitehat Hacker: 2000 [X]
    Bobo's Guardian: 2500 [X]
    Upcoming MPGHiean: 3000 [X]
    MPGH Addict: 3500 [X]
    MPGHiean: 4000 [X]
    MPGH Knight: 4500 [X]
    MPGH Lord: 5000 [X]
    MPGH Champion: 5500 [X]
    MPGH King: 6000 [X]
    "Wish me a good luck."

  12. #9
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,920
    Reputation
    574
    Thanks
    5,050
    My Mood
    Twisted
    Guess i'll throw in my knowledge on this subject too then
    Code:
    bool Fun = false;
    //it's false since we dont want the fun to start on startup of our tool
    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                if (Fun)
                {
                    Fun = false;
                }
                else
                    Fun = true;
            }
    //very simple, upon clicking the button, the programm will check the state of Fun, if it's false, it will set it to true, and vice versa
    Code:
    private void timer1_Tick(object sender, EventArgs e)
            {
                if (Fun)
                {
                    //do your thing when it's active
                    Button1.Text = "On";
                }
                else
                   //do your thing when its off
                   Button1.Text = "Off";
            }
    I didnt bother to make a picture, cus if ppl wanna leech , they wont learn anything, so theyll have to ask for help later, and i wont help them then, so they only hurt themselves.
    This will keep doing what you told it to do, and wont stop untill u click the button to make it off, to prevent it, just make the 2nd part look something like this :
    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                if (Fun)
                {
                    //do your thing when you wanna turn it off
                    Fun = false;
                    Button1.Text = "Off";
                }
                else
                    //do your thing when you wanna turn it on
                     Button1.Text = "On";
                    Fun = true;
            }
    ^^^^Didnt bother to check it, but should work ... I always use timer
    Last edited by Horror; 10-30-2012 at 06:00 AM.
     

    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. #10
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by Isaakske View Post
    Guess i'll throw in my knowledge on this subject too then
    Code:
    bool Fun = false;
    //it's false since we dont want the fun to start on startup of our tool
    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                if (Fun)
                {
                    Fun = false;
                }
                else
                    Fun = true;
            }
    //very simple, upon clicking the button, the programm will check the state of Fun, if it's false, it will set it to true, and vice versa
    Code:
    private void timer1_Tick(object sender, EventArgs e)
            {
                if (Fun)
                {
                    //do your thing when it's active
                    Button1.Text = "On";
                }
                else
                   //do your thing when its off
                   Button1.Text = "Off";
            }
    I didnt bother to make a picture, cus if ppl wanna leech , they wont learn anything, so theyll have to ask for help later, and i wont help them then, so they only hurt themselves.
    This will keep doing what you told it to do, and wont stop untill u click the button to make it off, to prevent it, just make the 2nd part look something like this :
    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                if (Fun)
                {
                    //do your thing when you wanna turn it off
                    Fun = false;
                    Button1.Text = "Off";
                }
                else
                    //do your thing when you wanna turn it on
                     Button1.Text = "On";
                    Fun = true;
            }
    ^^^^Didnt bother to check it, but should work ... I always use timer
    Easier way:

    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                Fun = !Fun; //Nice little toggle
                if (Fun) Button1.Text = "Off";
                else Button1.Text = "On";
            }

  14. The Following User Says Thank You to Kenshin13 For This Useful Post:

    Jorndel (10-30-2012)

  15. #11
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring
    Well as I said many of you would know easier ways, i do these ways because it's easier for my brain to understand, I'm not that advanced enough in my opinion to start taking these short cuts xD

    I draw chart flows in paint and then code from it





  16. #12
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by NadeHouse View Post
    Well as I said many of you would know easier ways, i do these ways because it's easier for my brain to understand, I'm not that advanced enough in my opinion to start taking these short cuts xD

    I draw chart flows in paint and then code from it
    First time I ever heard of coding from flow charts...and in paint... :3

  17. #13
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring
    Quote Originally Posted by Kenshin13 View Post
    First time I ever heard of coding from flow charts...and in paint... :3
    Well when things get more complex and you are having trouble processing it in your mind, draw it, It helps





  18. #14
    NadeHouse's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    whitespace
    Posts
    337
    Reputation
    55
    Thanks
    2,268
    My Mood
    Daring
    ---------Bump---------





  19. #15
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by NadeHouse View Post
    ---------Bump---------
    Uhh why?......

Page 1 of 2 12 LastLast

Similar Threads

  1. how much can i get for a 2lt 3 with one perm?
    By deathb4dishonor in forum Combat Arms Selling / Trading / Buying
    Replies: 2
    Last Post: 01-08-2012, 07:49 AM
  2. [Tutorial] How to make a Launch Button for CF PH
    By Dark Side in forum CrossFire PH Discussions
    Replies: 12
    Last Post: 08-20-2011, 02:38 AM
  3. how to make a select all button for checkboxes
    By ac1d_buRn in forum Visual Basic Programming
    Replies: 5
    Last Post: 10-23-2009, 09:36 PM
  4. TUT how to make tnt work for vista users
    By igotfish1995 in forum Combat Arms Hacks & Cheats
    Replies: 5
    Last Post: 07-19-2009, 02:35 PM
  5. Replies: 0
    Last Post: 01-04-2006, 05:45 AM