Status Bar
-
I have the following code:
try { statusLabel.Text = "Attemting to connect..."; DataCon.Open(); .... }
Why dosn't "Attempting to connect..." show in the status bar until it has connected?
Use Application.DoEvents()
try { statusLabel.Text = Attempting to connect..."; Application.DoEvents(); DataCon.Open(); }
Basically calling the Application.DoEvents() forces your application to process everything up that point before proceeding to the next step in your code. Without it your user interface will appear to lock up until your done working with your data connection stuff. The other way to accomplish this would be to spawn your data connection stuff on another thread which then would make the main thread process the UI changes. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger -
I have the following code:
try { statusLabel.Text = "Attemting to connect..."; DataCon.Open(); .... }
Why dosn't "Attempting to connect..." show in the status bar until it has connected?
the StatusBar component is a little tricky. Does your StatusBar have panels? If so you should be addressing the panel to which you want the data to appear. For example, say you had statusBar1 and statusBarPanel1 defined in your app. Use statusBarPanel1.Text = "blah blah blah". Good luck Mike Luster CTI/IVR/Telephony SME
-
Use Application.DoEvents()
try { statusLabel.Text = Attempting to connect..."; Application.DoEvents(); DataCon.Open(); }
Basically calling the Application.DoEvents() forces your application to process everything up that point before proceeding to the next step in your code. Without it your user interface will appear to lock up until your done working with your data connection stuff. The other way to accomplish this would be to spawn your data connection stuff on another thread which then would make the main thread process the UI changes. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger