?
Solved

Display 2nd window while create background task

Posted on 2011-02-17
6
Medium Priority
?
289 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 600 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 1400 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

741 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