Chavdar

Chavdar

  • NA
  • 3
  • 0

How to show form and execute code without user input?

Mar 14 2011 5:48 AM
Hello,
this is probably an easy question, but I'm new to Windows Forms and can't seem to find anything on the Internet, so here it is:

I have a form, which connects to a WCF service and sends a file to the server. While doing that, the form should display some images and status messages. The only way I could get this to work is to have the user click a button for the whole thing to start. If I try to execute the code after InitializeComponent() or in Main(), it waits for it to finish execution, and only then shows the form with all text and images already in place. I tried using Button.PerformClick() on said button, but it didn't seem to work.

Is there a way to make it work without user input? The form will be started from another program with all command-line parameters it needs, so I don't really want another button click.

Thanks a lot,
Chavdar

Answers (3)