I put that code on a button_click event in a UserControl that I made.
It is supposed to work as a boolean. eg if the value is 1 then it should change it to 0
else if the value is 0 it should change it to 1.
The click event is not going to work for this. Click is fired after the button is pushed AND released.
Similar code has to be called by the MouseDown, MouseUp, KeyDown and KeyUp handlers. The xDown events fire when the button is pushed down and the mouse or key is still being held down. The xUp events fire when the mouse or key is released.
before selecting another event to let your code,
make a breakpoint after bottun_click() line,run your control in dubug mode check if
break point stop your program,therefore event has no problem,then check your condition state.
If you mean the Button1 handler should modify the Button1 text, then I see no problem, that works just fine. Mind you, you will see the results only after the Click handler has finished (unless you add a call to Refresh). So changing the text initially, performing a long operation, then changing the text back to its original, all in the one Click handler, will not show any change at all. But then, you shouldn't be doing long operations inside a handler on the GUI thread to begin with... Threads (and BackgroundWorkers) were invented to decouple long operations from the GUI thread.
Then you are doing something wrong. Maybe you have more than one Button1 in your project, and you're talking to the wrong one (it helps to use meaningful names). Maybe its initial text isn't neither "0" nor "1". Maybe ...
You will need to provide a more comprehensive description of what you have if you want to get more effective help around here.
Sorry, I am not going to download, unpack, and investigate a bunch of code, and neither would anyone else around here. If you want effective help, put some effort in describing the problem properly and provide the relevant pieces of code (inside your message, and using PRE tags), not just all of it.