codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » Visual Basic » Article

Visual Basic Visual Studio Style Tabs Control

Article by: Leontti A. Ramos M. (8/2/2002)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Summary: This is a lightweight control (just 84kb compiled) that adds Visual Studio style tabs to your projects. With a small footprint, this dll is a good start point to enhance your app user interface.
Viewed: 36053 times Rating (215 votes): 
 3.5 out of 5
 Rate this Article  Read Comments  Post Comments



Download source code and demo - 130 KB

This is a lightweight control (just 84kb compiled) that adds Visual Studio style tabs to your projects. With a small footprint, this dll is a good start point to enhance your app user interface (just rewriting the "RenderItem" code you can modify the item aspect to fit your needs). Simple demo project included.

The control is very easy to use. Here is actial full source code of the demo app:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
Private WithEvents m_oVTabs As CVSTabs
Private WithEvents m_oXPTabs As CXPTabs
Private m_oLastTab As TabItem

Private Sub Form_Load()
  Set m_oVTabs = New CVSTabs
  With m_oVTabs
    .LinkControl picTabs
    With .Tabs
      .Add "frmMultiRecord.vb"
      .Add "frmData.vb"
      .Add "frmMachine.vb"
      .Add "About"
      .Item(1).SetActive
    End With
    .RebuildImage
  End With

  Set m_oXPTabs = New CXPTabs
  With m_oXPTabs
    .LinkControl picXP
    With .Tabs
      .Add "frmMultiRecord.vb"
      .Add "frmData.vb"
      .Add "frmMachine.vb"
      .Add "Do you like it?"
    End With
    .RebuildImage
  End With
End Sub

Private Sub Form_Resize()
  picXP.Width = ScaleWidth
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set m_oVTabs = Nothing
End Sub

Private Sub m_oVTabs_TabActivated(oTab As rsVStudiotabs.TabItem)
  If (oTab.Key = "About"Then
    m_oVTabs.ShowAbout
    m_oLastTab.SetActive
  End If
End Sub

Private Sub m_oVTabs_TabDeactivated(oTab As TabItem)
  lblStatus = "Tab """ & oTab.Caption & """ deactivated."
  Debug.Print lblStatus
  Set m_oLastTab = oTab
End Sub

Private Sub m_oXPTabs_TabActivated(oTab As rsVStudiotabs.TabItem)
  lblStatus = "Tab """ & oTab.Caption & """ activated."
  Debug.Print lblStatus
End Sub

Private Sub tmrCaption_Timer()
  Dim LnIndex As Integer
  Dim LsTag As String

  LnIndex = ((Timer Mod m_oXPTabs.Tabs.Count+ 1)
  With m_oXPTabs.Tabs(LnIndex)
    If (.Tag = ""Then
      .Tag = .Caption
      .Caption = (.Caption & "*")
    Else
      .Caption = .Tag
      .Tag = ""
    End If
  End With
End Sub

Private Sub tmrFlip_Timer()
  m_oXPTabs.OnTop = (Not m_oXPTabs.OnTop)
End Sub

Private Sub tmrSelect_Timer()
  Dim LnIndex As Integer

  LnIndex = ((Timer Mod m_oXPTabs.Tabs.Count+ 1)
  m_oXPTabs.Tabs(LnIndex).SetActive
End Sub

License

You are free to use this component in your own projects as long as you include the following text in your about box: "Portions RamoSoft de México http://www.ramosoft.com/"

Please email me your comments.
Leontti A. Ramos M. (leontti@leontti.net)

Updates

10/3/2001 - Version 1.0.1. Updated with new .NET style tabs (suggested by Steven Sartain)

10/12/2001 - Version 1.0.2. Fixes a bug that caused a memory leak after some time using the code. The bug was noticed by Edward Moth, thank you.

2/20/2002 - Version 1.0.3. Added "those nice nifty arrows that appear if you have too many tabs to fit", as suggested by Steve Sartain. A small bug when removing a tab has been fixed.

 

Download source code and demo - 130 KB





CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on ' Visual Basic Visual Studio Style Tabs Control'
Posted by :  Archive Import (blue_boy) at 19:47 on Saturday, January 04, 2003
Is there a VS.NET style for this? I dont mean a .NET version but rather VS.NET Style tabs instead of the now ageing preVS.NET tabs?
Posted by :  Archive Import (naveen) at 13:01 on Thursday, August 07, 2003
Pleas send the extra components


To post comments you need to become a member. If you are already a member, please log in .

 



RELATED ARTICLES
Generate License Keys (such as CD keys on Microsoft software)
by Brian Gillham
This class allows you to generate license keys, such as the CD keys on the case of most Microsoft software
Communicating with the Database (Using ADO)
by Chaudhary Pradeep K. Roy
Using ADO to get connected with the database.
Visual Basic Read and Modify the Registry
by Kenneth Ives
Perform the four basic functions to the Windows registry. Add, change, delete, and query. Allows you to to read registry values, and modify both keys and values.
Generate an Array of Unique Random Numbers
by Brian Gillham
This function will generate an ARRAY of TRULY random numbers.
Beginning Resource Files in Visual Basic
by Kenneth Ives
Have you ever wanted to use graphics, such as icons, bitmaps, cursors, and AVI files? How about sound or even message box text? This can be an enormous amount of overhead. These are all examples of more files to keep track of when you distribute an application, DLL, or OCX. Lets find out how resource files can help....
Visual Basic Compact/Repair Access Database Utility
by Kenneth Ives
This utility will compact and repair the access database you select. It is actually more convenient to use this utility than do the same task with Access, because you don't have to save the database with a different name and then delete the old database when you are done: here, a temporary copy of the database is automatically created and deleted.
Creating a watermark in Excel with VBA
by Kenneth Ives
Adding a watermark to an Excel spreadsheet using VBA.
Change Cursor to Hour Glass
by Brian Gillham
A simple script to change the cursor to an hour glass.
Generate your own Random Numbers
by Thaha Hussain
This simple program generates random numbers using the basic mathematical methods.
Analog Clock
by Thaha Hussain
This program demonstrates Thaha Hussain's Clock Work Formula to paint an Analogue Clock.








Recent Forum Threads
• matrix prblm in java
• Re: how to open instantly a pop up window whenever a user sends a message to the other user
• Re: PING PROGRAM IN PERL
• Re: date of birth validation using java script-very urgent
• JAVA If statements
• Need Help with a Regular Expression
• Informations on HTML
• Re: FREE TV on your PC!
• Re: Using Lucene or Solr ?


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010