Hamza Anwer
Hamza Anwer

Reputation: 1

TabControl contents disappears when I execute the program

I have a Form that contains many controls including TabControl.

The problem occurs when I execute the program, the contents of the tabPage disappear.

The following are pictures of the Form before and after the Execute and the source code.

Before: Before

After: After

Source Code: http://www.mediafire.com/?8d19lx1h2wwgl3m

Upvotes: 0

Views: 335

Answers (1)

Fraser
Fraser

Reputation: 17094

It is hard to say for sure as with 'Telerik.WinControls' resource I can't run the code.

That said it looks to be a problem with how you are loading the Main Form. I presume the issue being you can see the controls in the designer in visual studio, but not when the code is run. To resolve this remove the Main_Load method and place its contents in the default Main constructor like so in the Main.cs file.

    public Main()
    {
        InitializeComponent();

        //Create Directory
        sFunctions.CreateDirectory("Pictures");

        ClassConnections conn = new ClassConnections();
        conn.setConnection(
          AppDomain.CurrentDomain.BaseDirectory + "\\Database\\",
          "MasterFile.mdb",
          "lib2006");

        publicMainForm = this;
    }

Then remove the line

this.Load += new System.EventHandler(this.Main_Load);

From the Main.Designer.cs file

Upvotes: 2

Related Questions