form lock or buttos disable?

Hello Experts,
I am developing visual c#.net application for win mobil 2003 se.
In my application I have a connect button which connect to the server through GPRS to get reent records and updates. The whole process runs good and i have a timer which do the same process  automatically every 2 minuts.
The problem is when i connect to the server manually or in every 2 minuts when the system do the connetion the interface is blocking all the time and when someone clicks another the button( you know about the users if thery do not get any immediate feedback they click click click ) and the system blocks forever.

I need a method to frees the whole screen to disable all the button process.
after the server connection process ( 3 or 4 seconds ) the system should come active for the user.

Now i have a solution to put another form in fornt of the main form to say the system is bussy. It comes automatically and disapiers after the connection process. But every 2 minutes it comes and the user is not happy with it.

Do anybody have any idea to solve this porblem.

Thanks in advance.

Hope to hear.
Ludo_DirckxAsked:
Who is Participating?
 
Fahad MukhtarConnect With a Mentor Distinguished EngineerCommented:
You can use this method to disable/enable all the buttons on a form

     private void EnableDisableButtons(bool enable)
        {
            foreach (Control c in this.Controls)
            {
                if (c is Button)
                    c.Enabled = enable;
            }
        }
0
 
bruintjeCommented:
Hello Ludo_Dirckx,

in the first timer tick
1. you can trigger a second timer that disables the buttons
2. set the interval to x seconds [to retrieve the data]
3. when it comes in its own tick it disables itself and enables the buttons again

this is just an idea not sure if its feasible

bruintje
0
 
Ludo_DirckxAuthor Commented:
Hi Bruintje, Desp
thanks for the speed reply.
i feel more confortable with Desp's answer.
I will work on it and let you know how it works.

Perfect answer desp. I appreciate that.
It works perfect.

thank you.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.