[Mono-bugs] [Bug 534452] New: TabControl exception when removing tab pages

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Aug 26 10:57:09 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=534452


           Summary: TabControl exception when removing tab pages
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jxelam at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:

Exception is thrown when a tab page is removed from a tab control when the
SelectedIndex of the tab control matches the number of tabs before the removal.

Steps to reproduce the problem:
1. Compile and run the below program (-R:System.Windows.Forms)

Minimalistic test app (quick and hacky to just demonstrate the issue)

using System;
using System.IO;
using System.Windows.Forms;

class TabControlFail {
    static void Main(string[] args) {
        Application.Run(new FailForm());
    }

    public class FailForm : Form {
        private TabControl tab;
        private TabPage page;

        public FailForm() {
            tab  = new TabControl();
            page = new TabPage();

            tab.TabPages.Add(page);
            tab.TabPages.Add(new TabPage());
            tab.TabPages.Add(new TabPage());

            tab.SelectedIndex = 2;
            Controls.Add(tab);

            Visible = false;
            Activated += new System.EventHandler(delTabs);
        }

        private void delTabs(object sender, EventArgs e) {
            tab.TabPages.Remove(page);
        }
    }
}

Actual Results:

System.ArgumentOutOfRangeException: ControlCollection does not have that many
co
ntrols
Parameter name: index
2
at System.Windows.Forms.Control+ControlCollection.get_Item (Int32 index) [0x00
000]

Expected Results:

Tab to be removed without error

How often does this happen? 

Every time

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list