Working With Text Boxes, Check Boxes, and Radio Buttons

The properties for getting data values in and out of Windows Form controls vary somewhat from one control to the next. This can be a nuisance, but it’s a necessary one, driven by differences in the way each control operates.

Getting data in and out of a TextBox control is simplicity itself—just retrieve or set the value of its Text property. The same approach works for Label controls and most others where the data value consists of one and only one String value.

CheckBox and RadioButton controls, by contrast, have a Checked property that’s either True or False. If the Checked property is True, the control is checked; otherwise, it’s cleared. To check or clear a check box or radio button from ...

Get Faster Smarter Beginning Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.