1 / 14

Topics

Topics. Check Boxes Radio Buttons Date Time Picker Masked Text Box List Boxes Combo Boxes Spinner Control. “Those parts of a computer you can hit with a hammer are called hardware; those program instructions you can only curse at are called software” Unknown. Check Boxes.

baumgarten
Download Presentation

Topics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Topics • Check Boxes • Radio Buttons • Date Time Picker • Masked Text Box • List Boxes • Combo Boxes • Spinner Control “Those parts of a computer you can hit with a hammer are called hardware; those program instructions you can only curse at are called software” Unknown

  2. Check Boxes • Check boxes enable the user to indicate a single “Boolean” (Yes or No) state by checking or unchecking the box • The control’s Checked property will be read as either True or False • The CheckChanged event executes if the box state is changed by the user or in code • The Text property provides a label and a hot key • Selecting the hot key toggles the checked status of the box • All check boxes act independently

  3. Radio Buttons • Radio buttons belong to a group • All buttons directly on the face of the form belong to the same group • All radio buttons in the same group box are in the same group • Only one button in a group may be pressed at a time • Selecting one in a group unselects all others • All button CheckChanged events execute • The Checked property indicates whether checked or not

  4. Date Time Picker Control • Presents a calendar that lets user find a date easily • Value property contains the selected date, including the current time as a datetime data type • Text property is a string representation of the Value (not available at design time) • Default Value is current system clock time • May set value in code • Other date formats are available • ValueChanged event is the default event • Very useful with date-time functions (later)

  5. Masked Text Box • Provides various predefined as well as custom formats to force user input into a “mask” • Typing forces characters into available mask spaces • Control also validates input • No letters allowed in the Phone Number mask • Selecting control and thenproperties arrow gives quick access to mask dialog • Many controls have this quick access feature

  6. Masked Text Box (cont.)

  7. Masked Text Box (cont.) • TextMaskFormat propertydetermines if mask charactersare included in the Text property of the control • Default is IncludeLiterals (they are) • You may wish to use ExcludePromptAndLiterals • Same behavior for CutCopyMaskFormat property

  8. List Boxes and Como Boxes • All of the properties and methods illustrated in code for the list box form work on combo boxes as well • Reading • Adding & removing items • Setting selected item • Code • User selection • Sorting • Text property gives access to current text

  9. Adding List Items at Design Time • Add the control • Select the Items property in property window ORSelect the properties arrow on the control & choose “Edit Items” • Add one item per line in the edit window • These items willbe the initial contents of the list or combo

  10. Adjusting List Items at Run Time • ControlName.Items.Add(value) • Adds value to the end of the list • ControlName.Items.Insert(index, value) • Adds the value into the list position specified by index • Other items are pushed upwards to make room • ControlName.Items.RemoveAt(index) • Removes the item in the index location • Other items are moved downward to fill in

  11. List Items Properties • ControlName.Items.Count • Number of items in the list (1-based counting) • .SelectedIndex • Index in the list of the item that is selected • Zero-based numbering • If there are five items in the list • The .Count property = 5 • The items are indexed as 0 – 4 • This approach is used for any collection in .Net

  12. List & Combo Box Behavior • List and Combo boxes will add vertical scroll bars when needed—allow enough width if contents are wide • List boxes and Simple combo boxes are always open • List boxes and DropDownList style combo boxes do not allow users to type in a value—must select • DropDown and Simple style combo boxes allow the user to enter a value not in the list

  13. Group Boxes • Uses • Provide visual grouping of controls with a common caption • Allow a group of controls to be enabled or disabled or turned visible or invisible in one step • Allow you to create multiple independent groups of radio buttons • Text property labels the group box • I suggest a leading and trailing space so frame doesn’t pinch the text

  14. Numeric UpDown (Spinner) Control • Allows user to select a numeric value using the up/down arrows • Useful properties: • Value—currently displayed number • Maximum and Minimum—smallest and largest values spinner will reach • Decimal places • Increment • ValueChanged is most useful event Use together to create a fractionally incrementing spinner

More Related