Solved

Display 2nd window while create background task

Posted on 2011-02-17
6
276 Views
Last Modified: 2013-12-17
Hi,

I don't understand why my 2nd window not appearing while I can background task:

     private void button1_Click_2(object sender, System.EventArgs e)
        {
            FirmWare fw = new FirmWare("gvruwebtester.dll", null, "gvruwebtester.dll");
           
            Initialization frmInit = new Initialization();
            frmInit.Show();   <---- not showing ??????
            // frmInit.progressInit.Visible = true;
            bgw.RunWorkerAsync(fw);
        }

Thanks,
JT
0
Comment
Question by:jtran007
6 Comments
 
LVL 10

Assisted Solution

by:ALaRiva
ALaRiva earned 150 total points
ID: 34921980
What code do you have running in the constructor of that class?

Is it appearing AFTER the code runs? Or never opens at all?

My assumption would be that you are running all of your code in the constructor and then dumping the form after, which essentially means that you will never see the form.

More details please.

- Anthony
0
 
LVL 11

Accepted Solution

by:
Sudhakar Pulivarthi earned 350 total points
ID: 34922152
Hi try this.

private void button1_Click_2(object sender, System.EventArgs e)
        {  
            Initialization frmInit = new Initialization();
            frmInit.Show();
            // frmInit.progressInit.Visible = true;

            FirmWare fw = new FirmWare("gvruwebtester.dll", null, "gvruwebtester.dll"); // This might be the problem causer, please check whether its returning / taking long time.
            bgw.RunWorkerAsync(fw);
        }
0
 

Author Comment

by:jtran007
ID: 34922724
Hi,

I just put delay time after show. Then my second window appears. I don't understand why.
Anyway it solves my problem. Thanks.
JT
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 3

Expert Comment

by:chandra_darbha
ID: 34923033
That means, the application thread is getting busy executing the FirmWare constructor and hence the Form is not getting displayed. Looking at the constructor parameters it gives a feel of Assembly loading etc., Reflection API. Are you doing any reflection in the constructor?

Thanks,
Chandra
0
 

Author Comment

by:jtran007
ID: 34925860
Hi,

No.I don't use reflection. Just initialize serial port.

Cheers,
JT
0
 

Author Closing Comment

by:jtran007
ID: 35380729
Thanks,
JT
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now