473,466 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Tabpages ordering

VJ
Is there a way to Order Tabpages..

I tried to Use a Class that implements the IComparer and a Compare method as
suggested in the MSDN article. "ArrayList.Sort()" and then use the instance
of this class to sort like..

tbControl.TabPages.Sort(lstSorter)

There seems to be no effect..... I have tried debugging, the sorting seems
to happen, but Tabpages don't get rearranged. I even tried Referesh(),
Invalidate() methods.. after sort, nothing seems to work...

VJ
Nov 21 '05 #1
3 4825
You have to remove the tabpages from tabcontrol and add them again in the
order you want them.

Private _tabs(3) As TabPage ' variable to hold tabpages

Private Sub SortTabPages(ByVal currentTab As TabPage)
' To reorder the tabs, clear the collection and add them again

TabControl1.TabPages.Clear()
For Each tab As TabPage In _tabs
If Not tab Is Nothing Then
TabControl1.TabPages.Add(tab)
End If
Next

TabControl1.SelectedTab = currentTab
End Sub

HTH,
Greg

"VJ" <vi********@yahoo.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
Is there a way to Order Tabpages..

I tried to Use a Class that implements the IComparer and a Compare method as suggested in the MSDN article. "ArrayList.Sort()" and then use the instance of this class to sort like..

tbControl.TabPages.Sort(lstSorter)

There seems to be no effect..... I have tried debugging, the sorting seems to happen, but Tabpages don't get rearranged. I even tried Referesh(),
Invalidate() methods.. after sort, nothing seems to work...

VJ

Nov 21 '05 #2
* "VJ" <vi********@yahoo.com> scripsit:
Is there a way to Order Tabpages..

I tried to Use a Class that implements the IComparer and a Compare method as
suggested in the MSDN article. "ArrayList.Sort()" and then use the instance
of this class to sort like..


Remove the 'TabPage' objects from the 'TabPages' collection and add them
in the desired order.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
No time for a proper answer, Im off to work.
Rather than remove and replace tabpages, which causes flicker, just swap
pages as you sort. Here's a quick implementation of swap without sort.

\\\
Public Sub SwapTabPages(ByVal tp1 As TabPage, ByVal tp2 As TabPage)
Dim Index1 As Integer = TabPages.IndexOf(tp1)
Dim Index2 As Integer = TabPages.IndexOf(tp2)
TabPages(Index1) = tp2
TabPages(Index2) = tp1
End Sub
///

If you're on about design time order then you'll find the answer here:
http://dotnetrix.co.uk/tabcontrols.html --> Tabpage order has changed

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"VJ" <vi********@yahoo.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
Is there a way to Order Tabpages..

I tried to Use a Class that implements the IComparer and a Compare method
as
suggested in the MSDN article. "ArrayList.Sort()" and then use the
instance
of this class to sort like..

tbControl.TabPages.Sort(lstSorter)

There seems to be no effect..... I have tried debugging, the sorting
seems
to happen, but Tabpages don't get rearranged. I even tried Referesh(),
Invalidate() methods.. after sort, nothing seems to work...

VJ

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Alexia | last post by:
Hi, I wanted to know how i can make the title that is displayed in a tabpage bold when it is selected. I have 4 tabpages and i want the user to know more clearly which one is selected. I...
0
by: Thanos | last post by:
Hi everybody. Excuse my english is not perfect. I would to hide TabPages but I have tried >> TabPage.hide() or >> TabPage.Visible = False but no luck. Maybe the current Tab control...
4
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a...
1
by: Luc | last post by:
Hi, I have a TabControl and, at runtime, I need to add some tabpages. The problem is that each tabpage is similar to the others and contains several controls. If I do...
7
by: Richard | last post by:
I have a form with seven tapages. These span only one record with a large number of fields (textboxes). On Tabpage1 I display a number of read-only text boxes. This displays information about...
2
by: Kevin | last post by:
Although lots of people described how to workaround the lack of ability to hide and show tab pages on a tab control, I couldnt find a code example so I made one. Create a class that inherits from...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
7
by: davidpryce123 | last post by:
Dear Windows Form Designers I am developing an application that uses a TabControl with several Tabpages. On the different Tabpages I wish to allow users to have the access to the same...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.