Start a job

  • Thread starter Thread starter Rinaldo
  • Start date Start date
R

Rinaldo

In my program, if the user click on the backupbutton a second dialog
appears. How to start the job automatticly. I think in form_Activated like
this:

Code Blockpublic

frmUpload()
{

InitializeComponent();

}

private void frmUpload_Activated(object sender, EventArgs e)

{

\\ Start the job here


}

private void btnAnnuleer_Click(object sender, EventArgs e)

{

this.Close();

}

or is there another way to accomplish this.



Rinaldo
 
Rinaldo,

What do you mean by start a job? Are you looking to call another
component or start another program? Either way, if that component/program
presents a dialog to the user, you have to tell that program/component to
not do so. If it's not an option, then there is little you can do without
resorting to unsupported techniques (reflection on private properties,
sending windows messages to the dialog, etc, etc).
 
Hi Nicholas,

What I mean is: if I call a second form I don't want to wait for a user
event to click a button (Start for example) but start some routines
inmiddiatly and show the outgoing messages on the second form.

On the second form there is a cancel button so the user can interrupt the
operation.

I hope I be cleare now (I'm not english or american, so it is difficult to
explain what i mean)

Rinaldo

Nicholas Paldino said:
Rinaldo,

What do you mean by start a job? Are you looking to call another
component or start another program? Either way, if that component/program
presents a dialog to the user, you have to tell that program/component to
not do so. If it's not an option, then there is little you can do without
resorting to unsupported techniques (reflection on private properties,
sending windows messages to the dialog, etc, etc).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Rinaldo said:
In my program, if the user click on the backupbutton a second dialog
appears. How to start the job automatticly. I think in form_Activated
like this:

Code Blockpublic

frmUpload()
{

InitializeComponent();

}

private void frmUpload_Activated(object sender, EventArgs e)

{

\\ Start the job here


}

private void btnAnnuleer_Click(object sender, EventArgs e)

{

this.Close();

}

or is there another way to accomplish this.



Rinaldo
 
In the load event the second form is not show yet. I want to wait that the
second form is displayed so I can write some information to it.

See my next message to Nicholas....
 
What I mean is: if I call a second form I don't want to wait for a user
event to click a button (Start for example) but start some routines
inmiddiatly and show the outgoing messages on the second form.

Assuming that you already have a single method that you _could_ call
when the user clicks a button (i.e. "Start for example", as you wrote),
then you can simply call that method in the same place you show the
second form, or in the second form's initialization (for example,
override the OnLoad() method and call that single method there).

Which place is best would depend somewhat on the exact nature of the
processing you're trying to start. Generally speaking though, I'd say
that if the processing is to be started _every time_ you create and
show this second form, and the processing is in some way closely tied
to the second form, then putting in the OnLoad() override the call to
the method to start the processing would be best.

Pete
 
Thanx Pete, it helped me to the right way.......

Peter Duniho said:
Assuming that you already have a single method that you _could_ call when
the user clicks a button (i.e. "Start for example", as you wrote), then
you can simply call that method in the same place you show the second
form, or in the second form's initialization (for example, override the
OnLoad() method and call that single method there).

Which place is best would depend somewhat on the exact nature of the
processing you're trying to start. Generally speaking though, I'd say
that if the processing is to be started _every time_ you create and show
this second form, and the processing is in some way closely tied to the
second form, then putting in the OnLoad() override the call to the method
to start the processing would be best.

Pete
 

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

Back
Top