473,587 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ 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.TabPa ges.Sort(lstSor ter)

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 4840
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(By Val currentTab As TabPage)
' To reorder the tabs, clear the collection and add them again

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

TabControl1.Sel ectedTab = currentTab
End Sub

HTH,
Greg

"VJ" <vi********@yah oo.com> wrote in message
news:eg******** ******@TK2MSFTN GP09.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.TabPa ges.Sort(lstSor ter)

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********@yah oo.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(By Val tp1 As TabPage, ByVal tp2 As TabPage)
Dim Index1 As Integer = TabPages.IndexO f(tp1)
Dim Index2 As Integer = TabPages.IndexO f(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********@yah oo.com> wrote in message
news:eg******** ******@TK2MSFTN GP09.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.TabPa ges.Sort(lstSor ter)

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
3741
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 tried to do this but for some reason all the text on that particular page turns bold. Can any one give me some pointers?
0
1068
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 doesn't support hiding/unhiding
4
5917
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 single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the...
1
2724
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 TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added. How can I add in few statements a new tabpage as well as its controls (textboxes, labels, etc.)? The first...
7
3568
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 a particular Seller and is read from a SellerDataview at form load. On Tabpages 2-7, the information comes from another table/another...
2
1689
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 the tabcontrol and then add the following Private htVisibleVal As New Hashtable Private htVisibleKey As New Hashtable Private htInvisibleKey As...
11
18100
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 ListView columns so it should be doable, thanks
7
5567
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 controls for instance a textbox to enter a date and time string for search.
0
7918
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.