A Replacement For Tabs

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!

See also  Is Machine Learning Automating Creativity in Graphic Design?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist