Create Tabbed Dialogs
Tabbed dialog boxes are common in Excel. They break complex dialogs into multiple pages that replace each other as the user clicks on the different tabs. The Options dialog is a good example of a tabbed dialog.
The Toolbox includes two tabbed controls: TabStrip and MultiPage. The main difference between the two controls is that the MultiPage control provides paged containers for other controls. When a user clicks one of the tabs, that page automatically replaces the current page. With the TabStrip control, you have to create your own containers (usually a Frame control) and set the Visible property of that container to show or hide pages. In short, use the MultiPage to quickly create a tabbed dialog; use the TabStrip when you want to control the contents of pages programmatically.
To see how tabbed dialogs work, follow these steps based on the earlier Stock History sample:
In the Visual Basic Editor, choose Insert → UserForm to create a new form.
Click and drag a
MultiPagecontrol onto the form.Open the original Stock History form, select all the controls (Ctrl-A) and copy them (Ctrl-C). Select the
MultiPagecontrol and paste (Ctrl-V) the controls onto it.Copy and paste the code from the
frmStockHistoryclass to thefrmStockHistory2class.Click the Page1 tab on the
MultiPagecontrol and set itsCaptiontoHistory.Click the Page2 tab on the
MultiPagecontrol and set itsCaptiontoOptions. Then add the controls shown in Figure 20-12 with the settings listed in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access