Error in Winforms App

M

mendicant

First off, I'd like to apologize if this is in the wrong place, if it is let
me know and I will move it.

I am experiencing a weird error with a winforms app that I have built. In a
nutshell, two dates are entered and then a button is clicked which performs
some actions. In pseudocode, it looks like this:

private void btnQueryReport_Click(object sender, EventArgs e)
{
LogSomeInfo();
ConnectToWebService();
GetDataFromWebService();
BindDataToDataGrid();
}

The logging is done with log4Net.
Each method has some debug logging placed in it for tracing when problems
occur.
The app is running with the highest level of logging, so all messages should
be logged.

When run on my machine, the application behaves as expected. If you click on
the button, it logs the information, gets the data and displays the data, all
while logging debug statements as it goes. Normally this process takes about
15-20 seconds during which time the form 'freezes' while it processes the
data.

One of our users has just had a new computer built by our IT dept and upon
placing this application on his computer, it loads up fine, looks good and
appears to work. However, if you enter the dates and then click the button,
nothing happens. You can click the button as many times as you want and it
does nothing. It behaves as if:

private void btnQueryReport_Click(object sender, EventArgs e)
{
return;
}

This is being compiled as a .Net 2.0 application. There are no exceptions
being thrown. Nothing is caught, and no applicationexceptions are thrown
either.

Any ideas of where to look next?

Thanks in advance.
 
P

Peter Ritchie [C# MVP]

Something like ConnectToWebServce() and GetDataFromWebService() will be
variable in the amount of time they block the UI thread. On some computers
and depending on network load these methods may take a noticeable amount of
time, as you're seeing. While these methods are blocked the UI will be
unresponsive and on XP+ the user may see "(Not Responding)" while the UI is
unresponsive, which they don't like.

I would recommend doing them on a background thread, (e.g with
BackgroundWorker), provide some sort of notice to the user that the action is
"processing..." and update the form when the data has been downloaded.
 

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