in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

How to retrieve the index of a tabPage

Last post 8/13/2008 7:51 AM by Glen Harvy. 2 replies.
Page 1 of 1 (3 items)
Sort Posts:
Previous Next
  • 8/12/2008 8:49 PM

    How to retrieve the index of a tabPage

     I'm trying to remove a tabpage from a tabcontrol and all I know is the name of the tabpage which was created at runtime.

    I create:

    xtraTabPage = xtraTabControl1.TabPages.Add(module.Name);

    I destroy:

    xtraTabControl1.TabPages.Remove(module.Name); <== doesn't work.

    I can't even find how I locate the tab pages index if I only know it's name.

    Glen Harvy.
  • 8/13/2008 7:40 AM In reply to

    Re: How to retrieve the index of a tabPage

    Hi, I suppose you coud use a forloop and loop through all the tabpages to find the correct one and then your remove will work, cause you have to pass the page to remove.

    Example:

            private TabPage getTabPage(string name)
            {
                foreach (TabPage tp in tabControl.TabPages)
                {
                    if (tp.Name == name)
                    {
                        return tp;
                    }
                }
            }

     

    Hope this was what you were looking 4.

     

    Alex

  • 8/13/2008 7:51 AM In reply to

    Re: How to retrieve the index of a tabPage

     Hi,

    Yes - I ended up  doing for i loop and did it that way but I was surprised there isn't a method to get it.

    BTW: Using an i loop you can delete it immediately.

    Thanks for the feedback.

     

    Glen Harvy.
Page 1 of 1 (3 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED