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
| Control | Job at the till | Key property | Key event |
|---|---|---|---|
| Label | Display-only text (shop name) | Text | (rarely handled) |
| TextBox | Type the item name | Text | TextChanged |
| Button | Add item, print bill | Text | Click |
| CheckBox | Any-of extras (carry bag) | Checked | CheckedChanged |
| RadioButton | ONE payment mode of 3 | Checked | CheckedChanged |
| ComboBox | Pick a unit (kg/pkt/pc) | SelectedItem, Items | SelectedIndexChanged |
| ListBox | Pick from a visible list | Items, SelectedIndex | SelectedIndexChanged |
| DateTimePicker | Bill date | Value | ValueChanged |
At a glance
The specialists
| Control | Specialty | Remember it by |
|---|---|---|
| MaskedTextBox | Typing forced into a pattern | Mask = "0000000000" for a 10-digit phone |
| ProgressBar | Long task feedback | Minimum, Maximum, Value |
| PictureBox | Shows an image | Image, SizeMode |
| RichTextBox | Formatted text (bold, colour) | A TextBox with typography |
| TreeView | Hierarchies (category > item) | Nodes |
| ToolTip | Hover hint on another control | SetToolTip(btnAdd, "Adds to bill") |
| NotifyIcon | Lives in the system tray | The till keeps running minimised |
| LinkLabel | Clickable link text | LinkClicked |
| CheckedListBox | List where each row has a checkbox | CheckedItems |
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?
- Three CheckBoxes labelled Cash, Card, UPI
- Three RadioButtons labelled Cash, Card, UPI
- A TextBox where the cashier types the mode
- 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.