A Replacement For Tabs

You say you want to use a tab control, but you have so many topics thetabs will be unreadable? Try using a list box in conjunction with a controlarray of picture controls. The list box will contain entries the user canchoose; the picture controls will be containers for the various form subsectionsdesired. To demonstrate this, create a form with a list box (List1) on the leftand a Picture box (Picture1) on the right. Set the Index property of Picture1to zero, making it a control array. Then place this code in Form_Load:

 Private Sub Form_Load()	Dim x As Integer	For x = 0 To 15		List1.AddItem "Picture1(" & x & ")"	If x > 0 Then Load Picture1(x)	Picture(x).AutoRedraw = True		Picture(x).AutoRedraw = True		Picture(x).Visible = True		Picture(x).Left = Picture1(0).Left		Picture(x).Top = Picture1(0).Top		Picture(x).Width = Picture1(0).Width		Picture(x).Height = Picture1(0).Height		Picture1(x).Print "This is picture " & x	Next x	Me.Show: Me.Refresh	List1.ListIndex = 0End SubIn VB 4.0, you could use this syntax:With Picture1(x)	.AutoRedraw = True	.Visible = True	.Left = Picture1(0).Left	.Top = Picture1(0).Top	.Width = Picture1(0).Width	.Height = Picture1(0).HeightEnd With

Note that for a real application you wouldn’t dynamically create picturecontrols. You’d create them at design time and fill them with the controlsyou need. To demonstrate the concept, the example loads the control arrayat Form_Load. Place the following code in List1_Click:


Whenever the user clicks an item in the list, the relevant picture controlwill pop to the top of the stack, becoming visible. This provides tab-likefunctionality without the cost of a VBX or extra memory, and lets you createitems with as many pictures as you want, unfettered by tab width or tabcaption readability!

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may