Working with Tool Box Controls: common controls - Label, Text Box, Button, Check Box, Radio Button, Date Time Picker, List Box, Combo box, Picture Box, Rich Text Box, Tree View, Tool Tip, Progress bar, Masked Text box, Notify Icon, Link Label, Checked List box

Every Toolbox control is the same 3-part deal (properties, events, methods): learn the pattern once, then read the family table: TextBox for typing, RadioButton for one-of, CheckBox for any-of, ComboBox for pick-from-list.

12 min read · 10 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

Design the till, control by control

Put yourself at Mehta Stores' counter and list what the billing screen needs:

a title (just displayed), a box to type the item name, quantity typed as digits only, ONE payment mode picked from Cash/Card/UPI, maybe a carry-bag added on top, the bill date, an Add button, and a progress bar while the day report builds.

Every need on that list maps to exactly one Toolbox control. This lesson is the map, and one pattern makes all 17 learnable.

Formula

The 3-part pattern (learn once, apply 17 times)

Every control is the same deal:

  • Properties: its settings (Text, Checked, Value, Items)
  • Events: what it announces (Click, TextChanged, CheckedChanged)
  • Methods: what you can order it to do (Focus(), Items.Add())

So "learn TextBox" means: key property Text, key event TextChanged. Answer every control question in that shape and the marks follow.

At a glance

The everyday eight

ControlJob at the tillKey propertyKey event
LabelDisplay-only text (shop name)Text(rarely handled)
TextBoxType the item nameTextTextChanged
ButtonAdd item, print billTextClick
CheckBoxAny-of extras (carry bag)CheckedCheckedChanged
RadioButtonONE payment mode of 3CheckedCheckedChanged
ComboBoxPick a unit (kg/pkt/pc)SelectedItem, ItemsSelectedIndexChanged
ListBoxPick from a visible listItems, SelectedIndexSelectedIndexChanged
DateTimePickerBill dateValueValueChanged

At a glance

The specialists

ControlSpecialtyRemember it by
MaskedTextBoxTyping forced into a patternMask = "0000000000" for a 10-digit phone
ProgressBarLong task feedbackMinimum, Maximum, Value
PictureBoxShows an imageImage, SizeMode
RichTextBoxFormatted text (bold, colour)A TextBox with typography
TreeViewHierarchies (category > item)Nodes
ToolTipHover hint on another controlSetToolTip(btnAdd, "Adds to bill")
NotifyIconLives in the system trayThe till keeps running minimised
LinkLabelClickable link textLinkClicked
CheckedListBoxList where each row has a checkboxCheckedItems

Practical

The Add button reads the controls

Private Sub btnAdd_Click(sender As Object, e As EventArgs) _
        Handles btnAdd.Click
    Dim item As String = txtItem.Text
    Dim qty As Integer = CInt(txtQty.Text)

    Dim mode As String = "Cash"
    If rdoCard.Checked Then mode = "Card"
    If rdoUPI.Checked Then mode = "UPI"

    If chkBag.Checked Then qty += 1        ' carry bag added

    lblStatus.Text = item & " x" & qty & " (" & mode & ") on " & _
                     dtpBill.Value.ToString("dd/MM/yyyy")
End Sub

Quiz

The customer must choose exactly ONE payment mode, and Mehta Uncle wants all 3 options visible at a glance. Which control fits?

  1. Three CheckBoxes labelled Cash, Card, UPI
  2. Three RadioButtons labelled Cash, Card, UPI
  3. A TextBox where the cashier types the mode
  4. Three Buttons, one per mode
Show the answer

Three RadioButtons labelled Cash, Card, UPI

RadioButtons are BUILT for exactly-one-of-few: selecting one automatically deselects its siblings, and all options stay visible. CheckBoxes are independent, so Cash AND Card could both end up ticked: checkboxes mean any-of, radios mean one-of, the distinction this question exists to drill. A TextBox invites typos ("cassh") and validation pain. Buttons fire actions rather than remembering a choice; after clicking, nothing on screen shows which mode is selected. A ComboBox would also enforce one-of, but hides options behind a click, failing the visible-at-a-glance requirement.

Think first

Stop the alphabet reaching the quantity box

Quantity must be digits only, and phone numbers exactly 10 digits. A plain TextBox accepts "abc" happily. Scan the specialists table: which control fixes this at the TYPING stage, and how?

Show the answer

MaskedTextBox, via its Mask property: Mask = "0000000000" accepts exactly 10 digits and physically refuses letters as they are typed; no validation code, no error message needed, because the wrong input can never enter. The design lesson behind it: the best validation is a control that makes invalid input impossible, the UI cousin of Unit 2's Enum idea. For rules a mask cannot express (price must be positive), you still validate in code, and the ErrorProvider component 3 lessons ahead will show the polite way.

Watch out

Three control-picking mistakes

CheckBox where RadioButton belongs: any-of vs one-of; a bill paid by both Cash and Card is a data bug born in the designer.

TextBox.Text is always a String: CInt(txtQty.Text) before arithmetic, exactly like InputBox in Unit 2; "2" & 3 is not 5.

ListBox vs ComboBox by space: same idea (pick from Items); ListBox shows the list permanently, ComboBox folds it away. Choosing by look alone, without saying WHY, drops the reasoning mark.

Theory

Read any new control in 30 seconds

The pattern generalises past this syllabus: meet ANY unfamiliar control, in VB.NET or Android (BCA305-02's widgets were the same deal), and ask the 3 questions: what are its key properties? what events does it raise? what methods matter? The Properties window answers the first 2 directly (its lightning-bolt tab lists events). Next lesson: the containers that group these controls, and the radio-button surprise hiding inside that topic.

Summary

Key takeaways

  • Every control = properties (settings) + events (announcements) + methods (orders).
  • Core mapping: Label displays, TextBox types, Button clicks, DateTimePicker dates.
  • Choices: CheckBox = any-of (independent); RadioButton = exactly-one-of; ComboBox/ListBox = pick from Items.
  • Specialists: MaskedTextBox forces a typing pattern, ProgressBar shows Value between Minimum and Maximum, ToolTip attaches hover hints, NotifyIcon sits in the tray.
  • TextBox.Text is a String: convert before arithmetic.
  • Prefer controls that make invalid input impossible over code that scolds afterwards.
  • Memory hook: radios pick one, checks pick many, combos pick from a list.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Introduction to Windows controls

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati