Solved

Display 2nd window while create background task

Posted on 2011-02-17
6
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Selenium: Transitioning from unit testing to automated testing 4 60
IDE for Python 5 69
pressing download button in c# 7 34
Need help with another query 10 37
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 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