Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you change the current tab to bold for tab control?

Status
Not open for further replies.

vzjfgm

Programmer
Jul 24, 2003
34
US
How do you make the current tab page text bold?
 
Don't believe you can. However, you could hide the tabs and simulate them by placing labels above the tab control to simulate the tabs.
 
Thanks for the help. It didn't work for me. After I got rid of the tabs, I had nothing to click on to change the page. Do you think a button might work? I tried two buttons but, I don't know what property to use to change the page.
 
This is what I do. I hide the tabs (and set the tab control to transparent (not required, but sometimes looks better then the gray)). Then I place labels above the tab control where the tabs used to be. I set the Special Effect property of the labels to raised. I then set the OnClick event of each of the labels to a function. Then, when the user selects a label, the function is called which changes the top and height property of the selected label and also the previous label that was selected (this simulates how the "real" tabs work).

Therefore, the following code sets a public variable to the tab currently selected (via the OnLoad event) and also handles when the labels are selected. Note that in the OnClick event of each of the labels, pass the tab page number you want displayed.

Note that in this example, TabCtl is the name of the tab control and notice that I'm using the top of the Details section as my anchor point.


1st Label
OnClick....=SelectTab("NameOfFirstLabel",0)

2nd Label
OnClick....=SelectTab("NameOfSecondLabel",1)

etc.



Option Compare Database
Option Explicit

Dim mstrLabelSelected As String
Dim mintLabelSelected As Integer

Private Sub Form_Load()

mstrLabelSelected = "NameOf1stLabel"
mintLabelSelected = 0

End Sub

Public Function SelectTab(strLabelSelected as string, intLabelSelected As Integer)

On Error Resume Next

If (strLabelSelected <> mstrLabelSelected) Then

Me(mstrLabelSelected).Height = 0.2083 * 1440
Me(mstrLabelSelected).Top = (Details.Top - (0.2083 * 1440))

Me(strLabelSelected).Top = (Details.Top - (0.25 * 1440))
Me(strLabelSelected).Height = 0.25 * 1440

TabCtl.Value = intLabelSelected

mstrLabelSelected = strLabelSelected
mintLabelSelected = intLabelSelected

End If

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top