I am working on a program in C#. My main form has a menu where I open files. One of my function takes about 4 minutes where a file is decoded and the decoded contents get stored into a SQL server database. However, once the Open File dialog box closes, my main form is not refreshed. You can see parts of the form where the file dialog box was overlayed and the display doesn't refresh until the decoding and data storage is complete. The only part of my form which does refresh during the decoding stage is the status strip at the bottom of the form!
How can I do a single refresh of my main form prior to decoding my file I just want the display to look less ugly once the operation starts!
Thanks
Sean

How do I refresh my form
Bernardm1
I'd suggest you to try working with Threading a bit, which useful to make a non-freezing user interface (but a bit harder to work with).
If you just want to keep your current way of working, you can use one the following lines to refresh the Form wherever you need to refresh it:
this.Refresh();
this.Invalidate();
formname.Refresh();
formname.Invalidate();
AndyDragon
1. According to your guide I see your idea but when I have a Mainform and call a new Dialog Form from Mainform
then I input and update data in Dialog Form. So I want to refresh data in Mainform that I've just inputted in Dialog form.
2. I also have a way to refresh data but I must use a Dataset. Mainform will use this dataset and when I call dialog form,
I will update data into that dataset. then I call Dataset.AcceptChange() method. I sure that data in main form will be update.
ShaTari
Set a timer event
activate the timer by onstart
private
void timer(){
System.Timers.Timer timer =
new System.Timers.Timer();timer.Elapsed +=
new ElapsedEventHandler(function); // check every 1 minuuttimer.Interval = 60000;
timer.Enabled =
true;timer.Start();
}
private
void function(object sender, ElapsedEventArgs e){
Roberto_1959
this.Refresh();
Application.Doevents();