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

हर Toolbox control same 3-part deal है (properties, events, methods): pattern एक बार सीखिए, फिर family table पढ़िए: typing के लिए TextBox, one-of के लिए RadioButton, any-of के लिए CheckBox, pick-from-list के लिए ComboBox।

12 min read · 10 cards · 2 checks

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


Theory

Till Design कीजिए, Control by Control

खुद को Mehta Stores के counter पर रखिए और list कीजिए billing screen को क्या चाहिए:

एक title (सिर्फ़ displayed), item name type करने के लिए एक box, quantity सिर्फ़ digits की तरह typed, Cash/Card/UPI में से ONE payment mode picked, शायद ऊपर एक carry-bag added, bill की date, एक Add button, और day report बनते हुए एक progress bar।

उस list की हर need exactly एक Toolbox control पर map होती है। यह lesson वह map है, और एक pattern सारे 17 को learnable बनाता है।

Formula

3-Part Pattern (एक बार सीखिए, 17 बार Apply कीजिए)

हर control same deal है:

  • Properties: इसकी settings (Text, Checked, Value, Items)
  • Events: यह क्या announce करता है (Click, TextChanged, CheckedChanged)
  • Methods: आप इसे क्या order कर सकते हैं (Focus(), Items.Add())

तो "TextBox सीखिए" का मतलब है: key property Text, key event TextChanged। हर control question को इसी shape में answer कीजिए और marks follow करते हैं।

At a glance

Everyday Eight

ControlTill पर JobKey PropertyKey Event
LabelDisplay-only text (shop का नाम)Text(शायद ही कभी handled)
TextBoxItem का नाम type कीजिएTextTextChanged
ButtonItem add कीजिए, bill print कीजिएTextClick
CheckBoxAny-of extras (carry bag)CheckedCheckedChanged
RadioButton3 में से ONE payment modeCheckedCheckedChanged
ComboBoxएक unit चुनिए (kg/pkt/pc)SelectedItem, ItemsSelectedIndexChanged
ListBoxएक visible list से चुनिएItems, SelectedIndexSelectedIndexChanged
DateTimePickerBill की dateValueValueChanged

At a glance

Specialists

ControlSpecialtyइसे याद रखने का तरीका
MaskedTextBoxTyping को एक pattern में force किया गया10-digit phone के लिए Mask = "0000000000"
ProgressBarLong task feedbackMinimum, Maximum, Value
PictureBoxएक image दिखाता हैImage, SizeMode
RichTextBoxFormatted text (bold, colour)typography वाला एक TextBox
TreeViewHierarchies (category > item)Nodes
ToolTipकिसी दूसरे control पर hover hintSetToolTip(btnAdd, "Adds to bill")
NotifyIconSystem tray में रहता हैTill minimised रहते हुए भी चलता रहता है
LinkLabelClickable link textLinkClicked
CheckedListBoxएक list जहाँ हर row में एक checkbox हैCheckedItems

Practical

Add Button, 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

Customer को exactly ONE payment mode चुनना ज़रूरी है, और Mehta Uncle चाहते हैं सारे 3 options एक नज़र में visible हों। कौन सा control fit करता है?

  1. Cash, Card, UPI labelled तीन CheckBoxes
  2. Cash, Card, UPI labelled तीन RadioButtons
  3. एक TextBox जहाँ cashier mode type करे
  4. तीन Buttons, हर mode के लिए एक
Show the answer

Cash, Card, UPI labelled तीन RadioButtons

RadioButtons exactly-one-of-few के लिए BUILT हैं: एक select करना automatically इसके siblings को deselect कर देता है, और सारे options visible रहते हैं। CheckBoxes independent हैं, तो Cash AND Card दोनों ticked हो सकते थे: checkboxes का मतलब any-of है, radios का one-of, वह distinction जिसे drill करने के लिए यह question exist करता है। एक TextBox typos invite करता है ("cassh") और validation pain। Buttons choice याद रखने के बजाय actions fire करते हैं; click के बाद, screen पर कुछ नहीं दिखाता कौन सा mode selected है। एक ComboBox भी one-of enforce करता, पर options को एक click के पीछे hide करता, visible-at-a-glance requirement fail करते हुए।

Think first

Alphabet को Quantity Box तक पहुँचने से रोकिए

Quantity सिर्फ़ digits होनी चाहिए, और phone numbers exactly 10 digits। एक plain TextBox "abc" happily accept कर लेता है। Specialists table scan कीजिए: कौन सा control इसे TYPING stage पर fix करता है, और कैसे?

Show the answer

MaskedTextBox, इसकी Mask property के ज़रिए: Mask = "0000000000" exactly 10 digits accept करता है और typed होते ही letters को physically refuse करता है; कोई validation code नहीं, कोई error message नहीं चाहिए, क्योंकि ग़लत input कभी अंदर आ ही नहीं सकता। इसके पीछे का design lesson: best validation एक ऐसा control है जो invalid input को impossible बना दे, Unit 2 के Enum idea का UI cousin। उन rules के लिए जिन्हें एक mask express नहीं कर सकता (price positive होना चाहिए), आप अभी भी code में validate करते हैं, और 3 lessons आगे वाला ErrorProvider component polite तरीका दिखाएगा।

Watch out

तीन Control-Picking Mistakes

CheckBox जहाँ RadioButton belong करता है: any-of बनाम one-of; Cash और Card दोनों से paid एक bill designer में born हुआ एक data bug है।

TextBox.Text हमेशा एक String है: arithmetic से पहले CInt(txtQty.Text), Unit 2 के InputBox जैसा exactly; "2" & 3, 5 नहीं है।

Space से ListBox बनाम ComboBox: same idea (Items से चुनना); ListBox list को permanently दिखाता है, ComboBox इसे fold away करता है। सिर्फ़ look से choose करना, बिना WHY बताए, reasoning mark drop करता है।

Theory

किसी भी नए Control को 30 Seconds में पढ़िए

Pattern इस syllabus से आगे भी generalise होता है: किसी भी unfamiliar control से मिलिए, VB.NET में या Android में (BCA305-02 के widgets same deal थे), और 3 questions पूछिए: इसकी key properties क्या हैं? यह कौन से events raise करता है? कौन से methods matter करते हैं? Properties window पहले 2 का directly answer देती है (इसका lightning-bolt tab events list करता है)। अगला lesson: वे containers जो इन controls को group करते हैं, और उस topic के अंदर छुपा radio-button surprise।

Summary

Key takeaways

  • हर control = properties (settings) + events (announcements) + methods (orders)।
  • Core mapping: Label display करता है, TextBox types लेता है, Button click होता है, DateTimePicker dates लेता है।
  • Choices: CheckBox = any-of (independent); RadioButton = exactly-one-of; ComboBox/ListBox = Items से pick।
  • Specialists: MaskedTextBox एक typing pattern force करता है, ProgressBar Minimum और Maximum के बीच Value दिखाता है, ToolTip hover hints attach करता है, NotifyIcon tray में बैठता है।
  • TextBox.Text एक String है: arithmetic से पहले convert कीजिए।
  • बाद में scold करने वाले code से बेहतर वे controls हैं जो invalid input को impossible बना दें।
  • Memory hook: radios एक चुनते हैं, checks कई चुनते हैं, combos एक 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