# Controls

The standard set of UI control classes that ship with twinBASIC lives in the **VB** built-in package --- see [VB Package](/tB/Packages/VB/index.md) for the package landing page. The classes below are grouped by purpose; each entry links to the per-class reference.

## Forms and host classes

These classes are *containers* rather than controls in the strict sense --- they host other controls and back the form/control designer in the IDE.

- [Form](/tB/Packages/VB/Form/index.md) -- top-level window hosting controls, menus, and a drawing surface.
- [MDIForm](/tB/Packages/VB/MDIForm/index.md) -- top-level MDI parent that hosts MDI-child [Form](/tB/Packages/VB/Form/index.md) instances inside a recessed client area.
- [UserControl](/tB/Packages/VB/UserControl/index.md) -- base class for designing a reusable ActiveX control in twinBASIC.
- [PropertyPage](/tB/Packages/VB/PropertyPage/index.md) -- container backing a single tab of a COM property-page dialog (the **(Custom)** popup on an ActiveX control's property browser).
- [Report](/tB/Packages/VB/Report/index.md) -- top-level window specialised for banded report layout, print preview, and printing.

## Buttons and toggles

- ![](/Reference/Images/Toolbox/CommandButton.png){:width="24" height="24"} [CommandButton](/tB/Packages/VB/CommandButton/index.md) -- push-button used to trigger an action.
- ![](/Reference/Images/Toolbox/CheckBox.png){:width="24" height="24"} [CheckBox](/tB/Packages/VB/CheckBox/index.md) -- two- or three-state check box with an optional text caption.
- ![](/Reference/Images/Toolbox/CheckMark.png){:width="24" height="24"} [CheckMark](/tB/Packages/VB/CheckMark/index.md) -- windowless check glyph that scales to fill its rectangle; no caption, no focus.
- ![](/Reference/Images/Toolbox/OptionButton.png){:width="24" height="24"} [OptionButton](/tB/Packages/VB/OptionButton/index.md) -- radio-button; option buttons sharing a container form a mutually-exclusive group.

## Text and value input

- ![](/Reference/Images/Toolbox/TextBox.png){:width="24" height="24"} [TextBox](/tB/Packages/VB/TextBox/index.md) -- single-line or multi-line edit control, with optional password masking and digit-only input.
- ![](/Reference/Images/Toolbox/ComboBox.png){:width="24" height="24"} [ComboBox](/tB/Packages/VB/ComboBox/index.md) -- edit field combined with a drop-down list of items.
- ![](/Reference/Images/Toolbox/ListBox.png){:width="24" height="24"} [ListBox](/tB/Packages/VB/ListBox/index.md) -- vertically-scrolling list of items, optionally multi-column and multi-select.
- ![](/Reference/Images/Toolbox/HScrollBar.png){:width="24" height="24"} [HScrollBar](/tB/Packages/VB/HScrollBar/index.md) -- stand-alone horizontal scroll bar.
- ![](/Reference/Images/Toolbox/VScrollBar.png){:width="24" height="24"} [VScrollBar](/tB/Packages/VB/VScrollBar/index.md) -- stand-alone vertical scroll bar.

## File-system browsing

These three controls are normally connected together to build a complete file picker.

- ![](/Reference/Images/Toolbox/DriveListBox.png){:width="24" height="24"} [DriveListBox](/tB/Packages/VB/DriveListBox/index.md) -- drop-down list of the drives the operating system reports.
- ![](/Reference/Images/Toolbox/DirListBox.png){:width="24" height="24"} [DirListBox](/tB/Packages/VB/DirListBox/index.md) -- directory-tree picker for a single path.
- ![](/Reference/Images/Toolbox/FileListBox.png){:width="24" height="24"} [FileListBox](/tB/Packages/VB/FileListBox/index.md) -- file list for a single directory, filtered by wildcard and file-attribute toggles.

## Containers

- ![](/Reference/Images/Toolbox/Frame.png){:width="24" height="24"} [Frame](/tB/Packages/VB/Frame/index.md) -- captioned container that groups related controls and scopes [OptionButton](/tB/Packages/VB/OptionButton/index.md) groups.
- ![](/Reference/Images/Toolbox/MultiFrame.png){:width="24" height="24"} [MultiFrame](/tB/Packages/VB/MultiFrame/index.md) -- layout container that arranges a set of [Frame](/tB/Packages/VB/Frame/index.md) controls in a horizontal or vertical strip.
- ![](/Reference/Images/Toolbox/PictureBox.png){:width="24" height="24"} [PictureBox](/tB/Packages/VB/PictureBox/index.md) -- Win32 native control combining picture display, a drawing surface, and a child-control container.

## Display-only

- ![](/Reference/Images/Toolbox/Label.png){:width="24" height="24"} [Label](/tB/Packages/VB/Label/index.md) -- windowless lightweight read-only text display, used for captions, status text, and keyboard mnemonics.
- ![](/Reference/Images/Toolbox/Image.png){:width="24" height="24"} [Image](/tB/Packages/VB/Image/index.md) -- windowless lightweight picture display; the small, efficient alternative to [PictureBox](/tB/Packages/VB/PictureBox/index.md).
- ![](/Reference/Images/Toolbox/Line.png){:width="24" height="24"} [Line](/tB/Packages/VB/Line/index.md) -- windowless single straight line between two endpoints.
- ![](/Reference/Images/Toolbox/Shape.png){:width="24" height="24"} [Shape](/tB/Packages/VB/Shape/index.md) -- windowless geometric primitive (rectangle, oval, circle, star, arrow, …) with configurable border, fill, and rotation.
- ![](/Reference/Images/Toolbox/QRCode.png){:width="24" height="24"} [QRCode](/tB/Packages/VB/QRCode/index.md) -- windowless QR-code renderer populated from a text or byte-array payload.

## Menus

- [Menu](/tB/Packages/VB/Menu/index.md) -- item in a Win32 native menu --- top-level entry on a [Form](/tB/Packages/VB/Form/index.md)'s or [MDIForm](/tB/Packages/VB/MDIForm/index.md)'s menu bar, a drop-down entry, or a separator.

## Data and external content

- ![](/Reference/Images/Toolbox/Data.png){:width="24" height="24"} [Data](/tB/Packages/VB/Data/index.md) -- Win32 native control that opens a DAO recordset and exposes record-navigation buttons for bound controls.
- ![](/Reference/Images/Toolbox/OLE.png){:width="24" height="24"} [OLE](/tB/Packages/VB/OLE/index.md) -- OLE container hosting a linked or embedded OLE Automation object (Word document, Excel sheet, …).
- ![](/Reference/Images/Toolbox/Timer.png){:width="24" height="24"} [Timer](/tB/Packages/VB/Timer/index.md) -- non-visual control that raises a periodic event at a programmable interval.

## Controls in other packages

The **VB** package is not the whole story, and a control you remember from VB6 may live
elsewhere:

- [WinNativeCommonCtls](/tB/Packages/WinNativeCommonCtls/index.md) replaces Microsoft Common Controls
  6.0 (`MSCOMCTL.OCX`) with Win32-native equivalents, keeping the VB6 member names so most
  ported code compiles unchanged. This is where
  ![](/Reference/Images/Toolbox/ListView.png){:width="24" height="24"} [ListView](/tB/Packages/WinNativeCommonCtls/ListView/index.md),
  ![](/Reference/Images/Toolbox/TreeView.png){:width="24" height="24"} [TreeView](/tB/Packages/WinNativeCommonCtls/TreeView/index.md),
  ![](/Reference/Images/Toolbox/ImageList.png){:width="24" height="24"} [ImageList](/tB/Packages/WinNativeCommonCtls/ImageList/index.md),
  ![](/Reference/Images/Toolbox/DTPicker.png){:width="24" height="24"} [DTPicker](/tB/Packages/WinNativeCommonCtls/DTPicker.md),
  ![](/Reference/Images/Toolbox/MonthView.png){:width="24" height="24"} [MonthView](/tB/Packages/WinNativeCommonCtls/MonthView.md),
  ![](/Reference/Images/Toolbox/ProgressBar.png){:width="24" height="24"} [ProgressBar](/tB/Packages/WinNativeCommonCtls/ProgressBar.md),
  ![](/Reference/Images/Toolbox/Slider.png){:width="24" height="24"} [Slider](/tB/Packages/WinNativeCommonCtls/Slider.md) and
  ![](/Reference/Images/Toolbox/UpDown.png){:width="24" height="24"} [UpDown](/tB/Packages/WinNativeCommonCtls/UpDown.md) are.
- [CustomControls](/tB/Packages/CustomControls/index.md) holds the owner-drawn **Waynes...** controls,
  which have no VB6 counterpart.
- [WebView2](/tB/Packages/WebView2/index.md) and [CEF](/tB/Packages/CEF/index.md) each host a browser engine.

Both of the first two ship with the IDE but are referenced on demand --- add them from
Project → References before the controls appear in the toolbox. See
[Built-In Packages](/tB/Packages/Built-In/index.md).

## Controls in contributed packages

[Contributed packages](/tB/Packages/Contributed/index.md) on the package server replace VB6 controls
that no package above has. These are by Krool:

- [VBFLXGRD18](/tB/Packages/Contributed/VBFLXGRD18/index.md) holds the
  [VBFlexGrid](/tB/Packages/Contributed/VBFLXGRD18/VBFlexGrid/index.md) control, a replacement for the
  Microsoft FlexGrid control of VB6 (`MSFLXGRD.OCX`).
- [VBCCR18](/tB/Packages/Contributed/VBCCR18/index.md) replaces the Microsoft common controls of VB6. It has controls that
  WinNativeCommonCtls lacks, among them
  [CoolBar](/tB/Packages/Contributed/VBCCR18/CoolBar/index.md),
  [ImageCombo](/tB/Packages/Contributed/VBCCR18/ImageCombo/index.md),
  [RichTextBox](/tB/Packages/Contributed/VBCCR18/RichTextBox/index.md),
  [StatusBar](/tB/Packages/Contributed/VBCCR18/StatusBar/index.md),
  [TabStrip](/tB/Packages/Contributed/VBCCR18/TabStrip/index.md) and
  [ToolBar](/tB/Packages/Contributed/VBCCR18/ToolBar/index.md). The **Standard EXE (+VBCCR)**
  template of the [New Project](/tB/IDE/Starting/New-Project.md) dialog makes a project that
  references it already.
- [VBComDlg](/tB/Packages/Contributed/VBComDlg/index.md) holds the **CommonDialog** class, whose members
  are modelled on those of the VB6 CommonDialog control (`COMDLG32.OCX`).

[Importing a package from TWINSERV](/Features/Packages/Importing-TWINSERV.md) describes how to
add one to a project.

## VB6 controls in twinBASIC
{: #vb6-controls }

This section lists the controls of VB6 and where each is in twinBASIC.

### Intrinsic controls

Every control of the VB6 toolbox that needs no component --- PictureBox to OLE --- has a class of
the same name in the [VB package](/tB/Packages/VB/index.md), listed above. Two things differ from VB6:

- The [OLE](/tB/Packages/VB/OLE/index.md) control is a stub. A form that holds one loads and lays it out,
  but the control cannot create, link or activate an OLE object.
- The DDE members (**LinkMode**, **LinkTopic**, **LinkExecute** and the others) and
  **RightToLeft** are not implemented on the controls that have them.

Each class page marks the members that are not implemented. The
[twinBASIC roadmap](https://twinbasic.com/roadmap) plans the remaining ones.

### ActiveX controls

VB6 also ships controls as ActiveX libraries, which a project adds as components. The table
lists each library with its controls and what replaces them. A replacement works in 32-bit
and 64-bit builds and needs no file registered.

| VB6 library | Controls | In twinBASIC |
|---|---|---|
| `MSCOMCTL.OCX` | ImageList, ListView, ProgressBar, Slider, TreeView | [WinNativeCommonCtls](/tB/Packages/WinNativeCommonCtls/index.md) |
| `MSCOMCTL.OCX` | [ImageCombo](/tB/Packages/Contributed/VBCCR18/ImageCombo/index.md), [StatusBar](/tB/Packages/Contributed/VBCCR18/StatusBar/index.md), [TabStrip](/tB/Packages/Contributed/VBCCR18/TabStrip/index.md), [Toolbar](/tB/Packages/Contributed/VBCCR18/ToolBar/index.md) | [VBCCR18](/tB/Packages/Contributed/VBCCR18/index.md) |
| `MSCOMCT2.OCX` | DTPicker, MonthView, UpDown | [WinNativeCommonCtls](/tB/Packages/WinNativeCommonCtls/index.md) |
| `MSCOMCT2.OCX` | [Animation](/tB/Packages/Contributed/VBCCR18/Animation.md) | [VBCCR18](/tB/Packages/Contributed/VBCCR18/index.md) |
| `MSCOMCT2.OCX` | FlatScrollBar | no replacement |
| `COMCT332.OCX` | [CoolBar](/tB/Packages/Contributed/VBCCR18/CoolBar/index.md) | [VBCCR18](/tB/Packages/Contributed/VBCCR18/index.md) |
| `COMDLG32.OCX` | CommonDialog | [VBComDlg](/tB/Packages/Contributed/VBComDlg/index.md) |
| `RICHTX32.OCX` | [RichTextBox](/tB/Packages/Contributed/VBCCR18/RichTextBox/index.md) | [VBCCR18](/tB/Packages/Contributed/VBCCR18/index.md) |
| `MSFLXGRD.OCX` | MSFlexGrid | [VBFLXGRD18](/tB/Packages/Contributed/VBFLXGRD18/index.md) |
| `MSHFLXGD.OCX` | MSHFlexGrid | no replacement |
| `SYSINFO.OCX` | [SysInfo](/tB/Packages/Contributed/VBCCR18/SysInfo.md) | [VBCCR18](/tB/Packages/Contributed/VBCCR18/index.md) |
| `TABCTL32.OCX` | SSTab | no replacement; see [NewTabCtl](/tB/Packages/Contributed/NewTabCtl/index.md), an experimental package |
| `MSWINSCK.OCX` | Winsock | planned |
| `MSMAPI32.OCX` | MAPISession, MAPIMessages | planned |
| `MSADODC.OCX` | Adodc | planned |
| `MSDATGRD.OCX` | DataGrid | planned |
| `MSCOMM32.OCX` | MSComm | planned |
| `MSINET.OCX` | Inet | no replacement |
| `MSMASK32.OCX` | MaskEdBox | no replacement |
| `MCI32.OCX` | MMControl | no replacement |
| `PICCLP32.OCX` | PictureClip | no replacement |
| `MSCHRT20.OCX` | MSChart | no replacement |
| `MSDATLST.OCX` | DataList, DataCombo | no replacement |
| `MSDATREP.OCX` | DataRepeater | no replacement |
| `DBGRID32.OCX` | DBGrid | no replacement |
| `DBLIST32.OCX` | DBList, DBCombo | no replacement |
| `MSRDC20.OCX` | RemoteData | no replacement |

`COMCTL32.OCX` and `COMCT232.OCX` hold the earlier versions of the controls of `MSCOMCTL.OCX`
and `MSCOMCT2.OCX`, and the same packages replace them.

*Planned* means that the roadmap names the control among the VB6 controls that twinBASIC will
implement itself. The roadmap states that all the remaining ones will follow.

A control with no replacement, and any other control of the table, can be used as VB6 uses
it: the VB6 library itself, added to the project. The VB6 libraries are 32-bit, so this works
in a 32-bit build only. See
[Can I use VB6's own ActiveX controls?](/FAQ.md#vb6-ocx) in the FAQ.

## Windows Forms counterparts
{: #windows-forms }

For a reader who knows .NET, the table names the Windows Forms class nearest to each control.
The classes are in the `System.Windows.Forms` namespace, and each link opens Microsoft's
reference for the class. A counterpart is the nearest class and not an equivalent: its members
and its behaviour differ.

| twinBASIC | Windows Forms |
|---|---|
| [Form](/tB/Packages/VB/Form/index.md) | [Form](https://learn.microsoft.com/dotnet/api/system.windows.forms.form) |
| [MDIForm](/tB/Packages/VB/MDIForm/index.md) | [Form](https://learn.microsoft.com/dotnet/api/system.windows.forms.form), with **IsMdiContainer** set |
| [UserControl](/tB/Packages/VB/UserControl/index.md) | [UserControl](https://learn.microsoft.com/dotnet/api/system.windows.forms.usercontrol) |
| [CommandButton](/tB/Packages/VB/CommandButton/index.md) | [Button](https://learn.microsoft.com/dotnet/api/system.windows.forms.button) |
| [CheckBox](/tB/Packages/VB/CheckBox/index.md) | [CheckBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.checkbox) |
| [OptionButton](/tB/Packages/VB/OptionButton/index.md) | [RadioButton](https://learn.microsoft.com/dotnet/api/system.windows.forms.radiobutton) |
| [TextBox](/tB/Packages/VB/TextBox/index.md) | [TextBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.textbox) |
| [ComboBox](/tB/Packages/VB/ComboBox/index.md) | [ComboBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.combobox) |
| [ListBox](/tB/Packages/VB/ListBox/index.md) | [ListBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.listbox) |
| [HScrollBar](/tB/Packages/VB/HScrollBar/index.md) | [HScrollBar](https://learn.microsoft.com/dotnet/api/system.windows.forms.hscrollbar) |
| [VScrollBar](/tB/Packages/VB/VScrollBar/index.md) | [VScrollBar](https://learn.microsoft.com/dotnet/api/system.windows.forms.vscrollbar) |
| [Frame](/tB/Packages/VB/Frame/index.md) | [GroupBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.groupbox) |
| [PictureBox](/tB/Packages/VB/PictureBox/index.md) | [PictureBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.picturebox) |
| [Image](/tB/Packages/VB/Image/index.md) | [PictureBox](https://learn.microsoft.com/dotnet/api/system.windows.forms.picturebox) |
| [Label](/tB/Packages/VB/Label/index.md) | [Label](https://learn.microsoft.com/dotnet/api/system.windows.forms.label) |
| [Timer](/tB/Packages/VB/Timer/index.md) | [Timer](https://learn.microsoft.com/dotnet/api/system.windows.forms.timer) |
| [Menu](/tB/Packages/VB/Menu/index.md) | [MenuStrip](https://learn.microsoft.com/dotnet/api/system.windows.forms.menustrip) |
| [Data](/tB/Packages/VB/Data/index.md) | [BindingNavigator](https://learn.microsoft.com/dotnet/api/system.windows.forms.bindingnavigator), with a [BindingSource](https://learn.microsoft.com/dotnet/api/system.windows.forms.bindingsource) |
| [ListView](/tB/Packages/WinNativeCommonCtls/ListView/index.md) | [ListView](https://learn.microsoft.com/dotnet/api/system.windows.forms.listview) |
| [TreeView](/tB/Packages/WinNativeCommonCtls/TreeView/index.md) | [TreeView](https://learn.microsoft.com/dotnet/api/system.windows.forms.treeview) |
| [ImageList](/tB/Packages/WinNativeCommonCtls/ImageList/index.md) | [ImageList](https://learn.microsoft.com/dotnet/api/system.windows.forms.imagelist) |
| [DTPicker](/tB/Packages/WinNativeCommonCtls/DTPicker.md) | [DateTimePicker](https://learn.microsoft.com/dotnet/api/system.windows.forms.datetimepicker) |
| [MonthView](/tB/Packages/WinNativeCommonCtls/MonthView.md) | [MonthCalendar](https://learn.microsoft.com/dotnet/api/system.windows.forms.monthcalendar) |
| [ProgressBar](/tB/Packages/WinNativeCommonCtls/ProgressBar.md) | [ProgressBar](https://learn.microsoft.com/dotnet/api/system.windows.forms.progressbar) |
| [Slider](/tB/Packages/WinNativeCommonCtls/Slider.md) | [TrackBar](https://learn.microsoft.com/dotnet/api/system.windows.forms.trackbar) |
| [UpDown](/tB/Packages/WinNativeCommonCtls/UpDown.md) | [NumericUpDown](https://learn.microsoft.com/dotnet/api/system.windows.forms.numericupdown) |

The other controls of this page have no close counterpart among the Windows Forms classes.
