CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2011
    Posts
    3

    Button Not Doing an action more then one time?

    When I click the first "buy" button, my label ( num1 ) gets from 0 to 1, but if I click again, it doesn't increase more, is it just the button that is made to do one action only one time? I can't figure this out...
    Here's the code : http://pastebin.com/dYcAx8Dj

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Button Not Doing an action more then one time?

    Put a breakpoint in the button handler, press F5 and debug your app. Press the Buy button. Does the bp get hit? When you press the Buy button again, does the bp get hit again?

    Btw, what kind of app is this? Winforms app? Asp.net app?

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Button Not Doing an action more then one time?

    Instead of giving a link to your code, post your code here, in CODE tags. People tend not to click on any link...

  4. #4
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: Button Not Doing an action more then one time?

    From quick look, you are creating a new instance of the Trademan every time the button is clicked, so you always deal with turn == 1.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  5. #5
    Join Date
    Jun 2011
    Posts
    3

    Re: Button Not Doing an action more then one time?

    Windows Form Application, and peoples tend not to like big post and don't have the code option and oohhhh that make sense, thanks everyone.

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Button Not Doing an action more then one time?

    Quote Originally Posted by MasterMind555 View Post
    and peoples tend not to like big post and don't have the code option and oohhhh that make sense, thanks everyone.
    I didn't ask for your sarcasm dude. I was just trying to let you see that you would get more responses by posting proper code, that's all. Do not come crying next time, when no one helps you - we are not mind readers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured