Getting a timer tick to fire during a form load

J

Jayyde

Is there any way to accomplish this? The forms _Load event fires off
several other small ones that I'd like to track time for. I can't get
either the Mdi Parent form's timer _Tick event or the child form that I'm
opening's _Tick to actually fire off. Any help any of you gurus can give me
will be much appreciated :).

-Jayyde
 
G

Guest

do you just want the form_load event to make other timers start?

private void Form1_Load(...)
{

Form2 frm = new Form2;

frm.Timer1.Start();

}
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

I'm not sure what you want, are you sauing that you create several other
forms (child form) in the form_load event and yuo want to know how long does
this take?

what is the use of the timer? , What timer are you using?
 
J

Jayyde

Basically I have a grid that is loaded on it's form's load event. I have it
(in between certain lines of code) incrementing a progress bar on the mdi
container form. What I would like a timer control to do is up the progress
bar by 1 every time it ticks so the user still knows something is happening
during the lines of code that take forever in one call (such as the actual
getdataset() call). Unfortunately while lines of code such as that are
executing I can't get either the timer on the mdi container or the timer on
the form that is loading to fire. If that doesn't explain it well let me
know and I'll give it another whack...

Thanks :).

-Jayyde
 
G

Guest

well it doesnt make sense to have a progressbar keep track of nothing, maybe
you should rethink ur UI....just my 2 cents, but show us your code and maybe
we can see whats going on
 
J

Jayyde

Here's an example of what I'm talking about--and how it's not wanting to
keep track of nothing--it's just giving the user the impression that
something is still happening when I can't keep track of exactly how much is
getting done per amount of time manually--just a little fascade for them...

************CODE*****************
frmMain frmParent = (frmMain)this.TopLevelControl;

frmParent.SetProgressBarValue(50, true);

frmParent.SetStatusBarText("Retrieving Unmapped Product records...", true);

DataSet ds = boProductClientLoadView.GetDataSet();
************************************


frmParent.SetProgressBarValue(75, true);

frmParent.SetStatusBarText("Loading data into grid...", true);

ugUnmappedProducts.DataSource = ds.Tables[0];
**************************************

frmParent.SetProgressBarValue(100, true);

frmParent.SetStatusBarText("Complete.", true);

****************************************

The starred lines are examples of lines of code where work is being done by
the app, but I can't track it. So what I want to happen is have a timer
tick away every second or two and just jump that progress bar up 1% each
time so the user thinks/knows that SOMETHING is happening still. Otherwise
it kind of looks like the app just froze on 50% or 75% while it does its
thing.

To Peter:

That sounds like a brilliant plan and one that I would immediately try
to implement if we weren't still trying to talk the boss-man into plunking
down the extra coin to upgrade us from VS 2003 to 2005. Is there anything
that would accomplish the same thing in 2003?



Thanks :).

-Jayyde
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You have to use a backgound thread to do that.

Do a search by Control.Invoke and you will see a lot of post regarding this
problem
 

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