CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Location
    Land of sunshine and June Gloom
    Posts
    171

    Form Designer Bug

    I have a project that has a form with a TabControl and lots of TabPages. There are too many tab pages to fit on the tab control, so it has a scroll arrow that allows you to scroll to the tab pages that do not fit.

    There is a serious problem. The InitializeComponent() code generated by Form Designer keeps changing the order in which it adds the tab pages.


    For example I start with

    Code:
    // InitializeCompnent
    this.tabCtrl1.Controls.Add(tabPage1);
    this.tabCtrl1.Controls.Add(tabPage2);
    this.tabCtrl1.Controls.Add(tabPage3);
    this.tabCtrl1.Controls.Add(tabPage4);
    this.tabCtrl1.Controls.Add(tabPage5);
    Then I add a button or something to one of the pages and I get

    Code:
    // InitializeCompnent
    this.tabCtrl1.Controls.Add(tabPage3);
    this.tabCtrl1.Controls.Add(tabPage1);
    this.tabCtrl1.Controls.Add(tabPage2);
    this.tabCtrl1.Controls.Add(tabPage5);
    this.tabCtrl1.Controls.Add(tabPage4);
    I have to keep changing it back to the correct order and everytime I edit the form in the designer, it rewrites InitializeComponent and puts the pages in the wrong order again. The ordering seems to be very random each time.

    Is this a known bug in C#? If so, they better fix it in the next release of .NET.

    Thanks in advance

  2. #2
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Re: Form Designer Bug

    this is a bug and remains valid even in new version.
    the solution is manully changing them in the code...
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured