What coding changes would I make to prevent the timeout errors from occuring?
What you need to do FIRST is determine what is being processed (presuming some SQL.)
The SECOND you need to determine what a reasonable time for that process to take - especially from the business side.
As an example it unreasonable to expect a user to wait for an hour for a web site to finish processing a request (where the web app is blocked until it is done.)
To "fix" a problem like this depends on the specifics of the problem but some or all of the following might be necessary but this is not a complete list.
- Tune the database/schema
- Adjust the SQL operation parameters or SQL itself.
- Rearch/design the interface to preclude such operations.
- Rearch/design the interface to create a batch processing system where a request is posted, some other process processes each request, and some time later a result is created, then the caller at some later time, may submit another (different) request to retrieve the result.
It is never easy!! We have a response file which has two types of decisions, ACCEPT and DECLINE with in the comma separated name/value pair. I am inserting this information in to the database and want only the decision ACCEPT. In cases in line contains DECLINE, I want to skip this current line and go to the next line.
using (StreamReader sr = new StreamReader(path))
while (sr.Peek() > -1)
string line = sr.ReadLine();
//extract the line contentsif( line.Contains("Accept")) // you can replace the condition with your choice
//Do Insert to database
Can you share the code how you invoke the SaveFileDialog, in my application its in front of the Winform UI.
It's the same SaveFileDialog with an additional button "Help" pressing the Help button should display a page on how to use this dialog. however when i tested in my PC pressing the Help buttons pops nothing.
Can you share the code how you invoke the SaveFileDialog
if (saveProjectDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
But I just found out it isn't just the SaveFileDialog doing it. Every MessageBox is doing the same. (No, nothing in the project is set to TopMost.)
I don't have anywhere to post screen captures at the moment, but the dialogs are different when ShowHelp is used or not. One is a huge Windows 7 Explorer-ish box, the other is a small dialog with the 5 icons down the left side for Recent Places, Desktop, Libraries, Computer, Network.
that's strange . hmmm.. lets try all other possibilities then.
1. Clean and Rebuild all your solution
2. create a new sample winformn with one button on it and to call the same method, if it works there something is modified in your code.
handled any other events?
Closing (prompts to save files)
Load (sets an MRU menu and lcoses the Splash form.
Thought it might be the Splash, but taking that out didn't fix it.
At this stage, I think I'll just go with a home-built prompt form instead of the MessageBox. At least that I can set to topmost...and it works. (It's also nice to have it look like the rest of the program instead of generic Windows box popping up.)
FYI, the Help button raises the HelpRequest event. It won't bring up the context sensitive help available via F1 or the ? button in the title bar, which probably comes courtesy of the Control.HelpRequested event.
This will happen if you're creating the message box in a different thread. Make sure that any event handlers on asynchronous processes (network communication, serial ports, BackgroundWorker, TPL or ThreadPool background tasks, etc) that refer to the UI get BeginInvoke'd.
You mentioned a splash screen ... that is often done on a separate thread to the main UI, so check you haven't ended up creating message boxes in that thread.
No threading in the app. Not even the Splash. No "weird" things involved except creating some bits and pieces on the fly.
I even tried setting the owner on the dialog, hoping it would pass it along and fix the problem, but to no avail.
Another odd thing the app does: when starting, it will appear on the screen wherever the mouse cursor happens to be, i.e. start it on monitor 1, then move the mouse over to monitor 2 to do something else and it will show up over there on monitor 2. (Extended display, dual monitors)