1

We have a Windows Form application for our fingerprint scanning for time keeping and it takes too much time for just initializing the control for the finger print scanning, around 5 to 10 minutes. So we need to create a loading form so that users will know that the application doesn't hang and they need to wait, but the cause of the long running process was inside the InitializeComponent() method from the initialization of the form.

My question is, how can I move the InitializeComponent() method to another thread so that I can show a loading form while initializing the form where the biometrics scanner control is, because it creates an error when accessing a UI control from another thread other than the main thread?

My code is in C#, Framework 2.0, build in Visual Studio 2008.

Please help, thanks in advance.

John Isaiah Carmona
  • 5,260
  • 10
  • 45
  • 79

3 Answers3

1

You can remove your control for the finger print scanning from the visual designer and create this control from the code using an additional background thread and writing a progress information during this process.

shadeglare
  • 7,006
  • 7
  • 47
  • 59
1

SO has lot of data about it:

How to update the GUI from another thread in C#?

Accessing UI in a thread

Best Way to Invoke Any Cross-Threaded Code?

you can find a lot more.

If still need help, post a comment.

Community
  • 1
  • 1
Azodious
  • 13,752
  • 1
  • 36
  • 71
0

You can find your InitializeCompoent(); method in yourForm.designer.cs, and from there you can modify it.