Controls
There are two differences between the controls and the Office ActiveX controls
1) windows form controls are implemented by extensible managed classes. Office controls are unmanaged
2) windows form controls have no concept of their location in relation to the containing workbook or document
You can use this.Controls collection to enumerate through all the controls
Control | Prefix | Comments |
BackgroundWorker | Allows the user to to execute an operation on a separate (dedicated) thread. | |
Button | btn | Allows the user to run a separate subroutine. |
CheckBox | chb | Allows the user to either select or deselect an option. |
CheckedListBox | chlb | Allows the user to select multiple items from a list of items. |
ColorDialog | (Common Control) | |
ComboBox | cbo | Allows the user to either select an item from a drop-down box or enter a different item. |
ContextMenuStrip | cms | |
DataGridView | dgr | Allows the user to display (and edit) a table of information. |
DateTimePicker | dtp | Allows the user to select a specific date and/or time. |
DHTML Editing Control | dht | Allows the user to display a web page (not supported). |
ErrorProvider | ||
FolderBrowserDialog | fol | (Common Control) Allows the user to browse, create and select folders (not files). |
FlowLayout | ||
FontDialog | (Common Control) | |
Frame = Panel | ||
GridLayout | ||
GroupBox | grp | Allows you to group other controls together. |
HScrollBar | hsb | Allows the user to drag a button in order to select a value. |
Image = PictureBox | ||
ImageList | img | Allows you to have a repository of images in your assembly. |
Label | lbl | Allows you to display text to the user. |
LinkLabel | llb | Allows you to include hyperlinks in your text. |
ListBox | lsb | Allows the user to select an item from a list of items. |
ListView | lsv | Allows the user to select a single (or multiple) items from a list with multiple columns. |
MenuStrip | msp | Allows the user to group commands by a common theme. |
MonthCalendar | mcl | |
NumericUpDown | nup | Allows the user to display numeric values. |
OpenFileDialog | (Common Control) | |
OptionButton = RadioButton | ||
PageSetupDialog | (Common Control) | |
Panel | pnl | Allows the user an area for grouping controls and scrolling. |
PictureBox | pic | (Image) Allows you to display a graphic or picture. |
ProgressBar | prg | Allows the user to indicate progress using a graphical bar. |
PrintDialog | (Common Control) | |
PrintPreviewDialog | (Common Control) | |
RadioButton | rad | (OptionButton) Allows the user to select from a list of possible distinct options. |
RefEdit | ref | |
RichTextBox | rch | Allows the user to display text with formatting. |
SaveFileDialog | (Common Control) | |
SplitContainer | spl | Allows you to split an area into two resizeable panels. |
Splitter | ||
SplitterPanel | ||
StatusStrip | sts | Allows you to add a status bar to your window. |
TabControl | tab | Allows you to display multiple tabs of the same controls. |
TableLayoutPanel | tlp | |
TextBox | txt | (EditBox) Allows you to display text and to allow the user to enter information. |
Timer | ||
ToolTip | tip | Allows you to display text when you hover over other controls. |
ToolStrip | tls | (ToolStripButton) Represents a panel in a StatusStrip control. |
TreeView | tvw | Allows you to display a hierarchy of nodes with parents and child. |
UserControl | ucl | |
VScrollBar | vsb | Allows the user to drag a button in order to select a value. |
WebBrowser | wbr | Allows the user to include a web browser on a form. |
WebView2 | wbv |
(View > Tab Order)
If you set the Font property on a form, prior to adding any controls then all the controls will inherit the font style for the form
You can select all the controls using (Ctrl + "A")
You can lock the controls (Format > Lock Controls). This prevents any of the controls on the form being accidently moved.
(Format > Align)
Aligning controls is made a lot easier by having the grid on the form
The alignments and sizing options
ActiveX Controls
You can easily expand the collection of controls that you have access to by loading ActiveX or COM controls.
When you add an ActiveX control to your Toolbox, Visual Studio displays them with the .NET controls and you can use them on your forms with few limitations. Visual Studio must create a wrapper for the control to enable it to be used in a .NET program.
Me.tabMyTabControl.Controls.Find(key:="mytag", SearchAllChildren=True)
bitmaps
icons
The System.Drawing namespace include numerous classes for creating graphics
Line | DrawLine |
Rectangle | DrawRectangle |
Arc | DrawArc |
Circle / Ellipse | DrawEllipse |
Polygon | DrawPolygon |
Curve | DrawCurve |
Beziersplines | DrawBezier |
Overloading Handlers
Private Sub Control_OnEvent() Handles Control1.OnEvent, Control2.OnEvent
What is a Custom Control ?
no user interface
Setting Focus
txtTextBox.Select()
KB - 822493
Me.ActiveControl = Me.txtMyTextbox
Me.txtMyTextbox.Focus
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext