forms - Event " Button Click" not Working C# -


i trying make program 2 buttons start , stop. here code:

namespace rctoonboardpc {         public partial class form1 : form     {          communication objcommunication = new communication();         datatable = new datatable();         public int a;          public form1()        {            initializecomponent();        }         private void button1_click(object sender, eventargs e)        {             objcommunication.intialisecan();            = 1;            = data.getaccessdatatable("testdata", "testdb.accdb");            this.datagridview1.datasource = a;            objcommunication.id0008update10ms(a,a);// runs infinte while if a=1                  }         private void button2_click(object sender, eventargs e)        {             = 0;             string timeend = datetime.now.tostring();             objcommunication.unintialisecan();                   environment.exit(1);             }          public void textbox1update(string message)         {             textbox1.text = message;         }     } } 

the issue face after "button1_click" set 1 , if a=1 method "id0008update10ms" runs infinite while. if try generate "button2_click" not able achieve it, or doesnt work @ never set zero. why issue?

if button1_click running infinite loop, block ui thread.

this means other events on ui thread cannot processed, including button2_click.


Comments