Presentation is loading. Please wait.

Presentation is loading. Please wait.

IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked.

Similar presentations


Presentation on theme: "IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked."— Presentation transcript:

1 IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 2 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 3 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 4 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 5 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 then properties arrow gives quick access to mask dialog –Many controls have this quick access feature

6 IMS 3253: Controls 6 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu Masked Text Box (cont.)

7 IMS 3253: Controls 7 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu Masked Text Box (cont.) TextMaskFormat property determines if mask characters are 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 IMS 3253: Controls 8 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 9 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu Adding List Items at Design Time Add the control Select the Items property in property window OR Select the properties arrow on the control & choose “Edit Items” Add one item per line in the edit window –These items will be the initial contents of the list or combo

10 IMS 3253: Controls 10 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 11 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 12 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 13 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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 IMS 3253: Controls 14 Dr. Lawrence West, MIS Dept., University of Central Florida lwest@bus.ucf.edu 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


Download ppt "IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked."

Similar presentations


Ads by Google