0

Hello,

I need some tips to develop an application(Windows Forms, C#). My app will read/write data to/from database. I wonder to know how can I develop displaing some message during reading or writting data to database. I will be grateful if you support me with any ideas.

2
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by sknake
0

Unless you're threading the calls to the database then the application's main thread will be unresponsive while a database call is being performed. Basically: "your application will lock up until the database call is complete". Are you wanting to show a progress form while DB I/O is taking place?

I personally find that annoying in most cases. Unless you are executing some long running queries then I would let the user ponder for a minute while the app works.

If you do want to use a progress form while the DB I/O is happening then let me know. You can look in to using a background worker to help thread the calls.

0

so your advice Scott is to use threads? I would be really grateful if you would show me example of using progress form during reading from DB.

0

My advice isn't to use threads but i'm saying thats what you need to do for the functionality you requested. If these DB reads are returning in less than one second I would let the app freeze up for a second while it runs. I suppose the "best" way is to use threads but you're opening up a can of worms. How long is your DB read lasting?

Anyway here is how to do it. Make sure you look in the designer file. I stuck a "#warning" in there where you need to implement a form disposal.

0

Oh and I just noticed.. You will need to either stop a user from closing the progress form while the operation is running OR set the "supportsCancel" property on the background worker to true and handle cancelling your DB I/O calls.

0

reading from db takes about 20 seconds.
Thanks a lot for file you attached and ideas. I will try to go on with my app next week and apply you suggestions

0

Sounds good. What I do is set the form's border style to No Border so they don't have the close buttons and make a 'pretty' progress screen.

Please mark this thread as solved if I have answered your question -- and good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.