Solved

Display 2nd window while create background task

Posted on 2011-02-17
6
277 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Loop not working 29 47
Vb.net dynamic formulas in runtime 11 61
Handle KeyDown for ToolStripDropDownButton, ToolStripMenuItem 3 22
Windows Media Player 2 11
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:…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

22 Experts available now in Live!

Get 1:1 Help Now