Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] C# During Execution of program I am not able to click any other button

Status
Not open for further replies.

rkt_167

Junior Member level 1
Joined
Aug 9, 2013
Messages
19
Helped
3
Reputation
6
Reaction score
3
Trophy points
3
Activity points
163
hi all,
I have build a GUI but I am not able to click any button during its execution give possible reason why i am getting this problem and also some solutions to overcome.

thanks,
 

hi all,
I have build a GUI but I am not able to click any button during its execution give possible reason why i am getting this problem and also some solutions to overcome.

thanks,
is the focus locked onto some other component?
have you added event handlers to the buttons?
if so what happens when you click the button - nothing?
putting a console output in event handlers is useful for debugging, e.g.
Code:
private void motorONbutton_Click(object sender, EventArgs e)
        {
        Console.WriteLine("motor on button clicked"); 
        motorON = 1;
        motorButton = true;
        motorPWM = false;
        }
you can always remove it later
 
hi horace,
Right now I have used Application.DoEvents(); But its process is very slow.
Actually, I don't know much about event handlers do guide me more about it.
Do you know about background working in C#?

Thanks,
 

hi horace,
Right now I have used Application.DoEvents(); But its process is very slow.
Actually, I don't know much about event handlers do guide me more about it.
Do you know about background working in C#?

Thanks,
if you do a web search on C# GUI event handling it will give you plenty of links, e.g.
https://msdn.microsoft.com/en-us/library/aa983763(v=vs.71).aspx

I often use a background worker (in effect another thread of control) to carry out time consuming tasks - add it to the Form, create a DoWork event and start it in the Form constructor, e.g.
Code:
        public Form1()
        {
            InitializeComponent();
            serialPort1.Open();
            backgroundWorker1.RunWorkerAsync();
        }
again plenty of example are on the web, e.g.
https://www.dreamincode.net/forums/topic/112547-using-the-backgroundworker-in-c#/
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top