Avatar of YANKAUSKAS
YANKAUSKASFlag for United States of America asked on

How to initialize the child form?

I have a form which is a child form of another form, but when the program start this child form also start, this mean that when the child form doesn't finish initialization, the main form can't start.
I use a list view to display the result from a server on this form. QueueParamsEvent will return the name of the queues, QueueMemberEvent will return the member of the queues. QueueEntryEvent will return the entry of the Queues.
But when the program is started, the two events: QueueMemberEvent and QueueEntryEvent will don't have anything because it haven't initialized yet. I want to initialize it as a null value, still display the list view and don't have anything in it, when we have the value, it will be displayed. But .... please help me!

The source code is below:



namespace MainForm
{
    public partial class FrmQueues : Form
    {
        ResponseEvents re;
        public FrmQueues()
        {
            InitializeComponent();
 
            this.MaximizeBox = false;
            this.MinimizeBox = false;
 
            lvQueues.Columns.Add("Queue");
            lvQueues.Columns.Add("tQueue");
            lvQueues.Columns.Add("ServiceLevel");
 
            lvQueuesMember.Columns.Add("Member");
            lvQueuesMember.Columns.Add("Queues");
            lvQueuesMember.Columns.Add("Location");
 
            lvQueuesEntry.Columns.Add("Entry");
            lvQueuesEntry.Columns.Add("Queues");
            lvQueuesEntry.Columns.Add("Channel");
            lvQueuesEntry.Columns.Add("Positions");
 
 
 
            //this.WindowState = FormWindowState.Maximized;       
            // Display Queues and Member
            try
            {
                re = GlobalVars.manager.Connection.SendEventGeneratingAction(new QueueStatusAction());
            }
            catch (EventTimeoutException e)
            {
            }
            foreach (ManagerEvent e in re.Events)
            {
                if (e is QueueParamsEvent)
                {
                    QueueParamsEvent qe = (QueueParamsEvent)e;
                    //lvQueues.Items.Add("QueueParamsEvent" + "\n\tQueue:\t\t" + qe.Queue + "\n\tServiceLevel:\t" + qe.ServiceLevel);
                    int n = lvQueues.Items.Count;
                    lvQueues.Items.Add("");
                    lvQueues.Items[n].SubItems.Add(qe.Queue.ToString());
                    lvQueues.Items[n].SubItems.Add(qe.ServiceLevel.ToString());
                }
                else if (e is QueueMemberEvent)
                {
                    QueueMemberEvent qme = (QueueMemberEvent)e;
                    //lvQueues.Items.Add("QueueMemberEvent" + "\n\tQueue:\t\t" + qme.Queue + "\n\tLocation:\t" + qme.Location);
                    //int n = lvQueues.Items.Count;
                    //lvQueuesMember.Items.Add("");
                    //lvQueuesMember.Items[n].SubItems.Add(qme.Queue.ToString());
                    //lvQueuesMember.Items[n].SubItems.Add(qme.Location.ToString());
                }
                else if (e is QueueEntryEvent)
                {
                    QueueEntryEvent qee = (QueueEntryEvent)e;
                    //lvQueues.Items.Add("QueueEntryEvent" + "\n\tQueue:\t\t" + qee.Queue + "\n\tChannel:\t" + qee.Channel + "\n\tPosition:\t" + qee.Position);
                    //int n = lvQueues.Items.Count;
                    //lvQueuesEntry.Items.Add("");
                    //lvQueuesEntry.Items[n].SubItems.Add(qee.Queue.ToString());
                    //lvQueuesEntry.Items[n].SubItems.Add(qee.Channel.ToString());
                    //lvQueuesEntry.Items[n].SubItems.Add(qee.Position.ToString());
                }
            }
  
        }
 
    
 
        //
            
 
       
    }
}

Open in new window

.NET ProgrammingC#

Avatar of undefined
Last Comment
Bruce_1975

8/22/2022 - Mon
SOLUTION
Alexandre Simões

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
YANKAUSKAS

I have a main form (Login form run first), then FrmMain (the main form of the program). In FrmMain I have one panel, then a lot of form loaded to this panel on the FrmMain. I initialize all the form at the start up, after that I hide all the form, when needed, I show the corresponding form. Maybe this way causing error but I can't start to do it again, pleasr suggest me how to fix these errors.
Thank you!
SOLUTION
Alexandre Simões

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck