Code for Windows Forms Controls
This topic is designed to help you find code that demonstrates how to perform common programming tasks with Windows Forms controls. The following categories are represented in the list below:
You can also find sample code for Windows Forms applications in these locations:
- Windows Applications Example Topics
- Windows Forms Controls Example Topics
- Visual Basic Sample Applications
- Visual Basic QuickStarts and Other Samples
- .NET Framework Reference Information
Putting Controls on Forms
Example of...
Arranging Controls
Example of...
Labeling Controls
Example of...
Providing accessibility information
Button Control
Example of...
Specifying a default (accept) button
CheckBox Control
Example of...
Responding when the user checks the check box
Determining the state of the check box
Taking action based on the check box state
ColorDialog Component
Example of...
Setting colors based on the user's selection
ComboBox, ListBox, CheckedListBox Controls
Example of...
Determining which items in a check box list are checked
DataGrid Control
Example of...
Responding when a user clicks or selects items
Responding when the user edits items
Creating a simple data access form
DateTimePicker Control
Example of...
DomainUpDown Control
Example of...
ErrorProvider Control
Example of...
Displaying data-binding errors
FolderBrowser Control
Example of...
Determining what folder the user selected
FontDialog Component
Example of...
Setting fonts based on the user's selection
ImageList Component
Example of...
Label Control
Example of...
Creating access keys with labels
LinkLabel Control
Example of...
ListView Control
Example of...
MainMenu, MenuItem, ContextMenu Components
Example of...
Adding check marks, shortcut keys, or access keys
Removing items from a context menu
Adding check marks and shortcut keys to menus
Creating a simple application using context menus
MonthCalendar Control
Example of...
NotifyIcon Component
Example of...
Linking a context menu to an icon
NumericUpDown Control
Example of...
OpenFileDialog Component
Example of...
Opening a file based on the user's selection
PageSetupDialog Component
Example of...
Setting print properties based on the user's selections
Panel Control
Example of...
Adding or removing controls dynamically
PictureBox Control
Example of...
PrintDialog, PrintDocument, PrintPreviewDialog Components
Example of...
Allowing the user to specify print options
Displaying a message that a print job has finished
ProgressBar Control
Example of...
RichTextBox Control
Example of...
Responding when the user changes text format
Displaying the contents of files
SaveFileDialog Component
Example of...
Saving a file based on the user's selection
Splitter Control
Example of...
Creating an Outlook-like user interface
StatusBar Control
Example of...
Displaying status bar values at run time
Determining which panel was clicked
TabControl Control
Example of...
TextBox Control
Example of...
Getting or setting text box values
Setting the location of the insertion point
Using the text box for passwords
Adding characters into a text box
Timer Component
Example of...
Running processes at set intervals
ToolBar Control
Example of...
Responding when the user clicks a toolbar button
ToolTip Component
Example of...
Setting ToolTip characteristics
Assigning tool tips to controls
TreeView Control
Example of...
Adding custom information to nodes
Determining what node the user clicked
Creating an Outlook-like user interface