DoEvents in MSDN Sample App

C

coder

I downloaded the C# Mobile Line of Business Solution Accelerator sample
app from MSDN and the UI code has DoEvents sprinkled all over the
place. It is tagged as a "best practices" sample but I've read from
many people that DoEvents is hardly ever appropriate. If anyone has
seen this code -- do you think this usage of DoEvents is appropriate?
Here's a sample of what I'm talking about:

/// <summary>
/// Replicate with SQL Server 2005
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItemSync_Click(object sender, EventArgs e)
{
Application.DoEvents();
Cursor.Current = Cursors.WaitCursor;
Application.DoEvents();

try
{
//Test to see if Network is available
Application.DoEvents();
statusBar1.Text = "Checking network connectivity...";
Application.DoEvents();
if (Business.Services.GetConnectionStatus())
{
//Test to see if Replication URL is reachable
Application.DoEvents();
statusBar1.Text = "Testing IIS server...";
Application.DoEvents();
if (Business.Services.CheckReplicationUrl())
 
G

Guest

If you know what DoEvents does, then using it is fine, and it shouldn't be
problematic. That said, the example seems to be overusing it a lot, yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top