Error editing a visual studio project in another pc

-1

I'm developing a project in Visual Studio and this project I'm continuing on a new PC, my problem is that when I run the project to know how it goes I get the following error.

    
asked by Camilo Ramirez Cristancho 23.10.2018 в 23:44
source

2 answers

0

Following your question I made a small reply

    private void button1_Click(object sender, EventArgs e)
    {
        var form = new Form2();
        openChild(form);
    }

    public void openChild(Form param)
    {
        var form = param as Form;
        panel1.Controls.Add(form);
        form.Show();
    }

In which I pass an object to the function openChild which receives a parameter of type Form and it worked, your problem is that when executing the function OpenFormHija it is possibly not receiving the object in your formhija parameter so I suggest you review the documentation on how to use a breakpoint and make sure that the object is arriving at your function

Here you can review the breakpoint documentation

The breakpoint helps you to debug your code by allowing you to review the information that is being handled during the execution of your application's events and to know in a more accurate way where the error is occurring, I hope it will be helpful.

    
answered by 24.10.2018 в 00:16
0

Good morning, in my opinion two things can happen: 1. You have not used the label "if" well and when you evaluate if the number of controls is greater than zero, the code does not do anything so it is always running the RemoveAt (0) and it is there where the index error occurs . Remember that the structure is:

if(condicion){
 //tu codigo en base a la condicion
}

2. Check the child form (fh) if it does not load any control that needs to have a parameter, because if you are opening a form that internally uploads data or evaluates a sentence, you must send it the same data when you assign it as a child.

    
answered by 24.10.2018 в 10:41