[go: up one dir, main page]

0% found this document useful (0 votes)
95 views27 pages

Combo Box

The document describes 7 different controls in Microsoft Visual Studio's toolbox: 1. ComboBox - Allows selecting from a drop-down list of items 2. CheckedListBox - Like a list box but allows checking items 3. Panel - Groups other controls visually and allows moving them together 4. MaskedTextBox - Provides input validation by masking text formats 5. RadioButton - Allows selecting one option from a group of choices 6. ListView - Displays a list of items like Windows Explorer 7. MonthCalendar - Allows selecting dates on a monthly calendar view

Uploaded by

Jawwad Rafiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views27 pages

Combo Box

The document describes 7 different controls in Microsoft Visual Studio's toolbox: 1. ComboBox - Allows selecting from a drop-down list of items 2. CheckedListBox - Like a list box but allows checking items 3. Panel - Groups other controls visually and allows moving them together 4. MaskedTextBox - Provides input validation by masking text formats 5. RadioButton - Allows selecting one option from a group of choices 6. ListView - Displays a list of items like Windows Explorer 7. MonthCalendar - Allows selecting dates on a monthly calendar view

Uploaded by

Jawwad Rafiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Scholars Group

Names: Registration Numbers:


• M. Bilal FA16-BCS-026
• M. Umair FA16-BCS-088
• Waseem Akhter FA16-BCS-082
• Zunair Talish FA16-BCS-044
Visual Studio
Toolbox (Controls)
1.ComboBox
• The ComboBox control is used to display a drop-down list of various
items. It is a combination of a TextBox in which enters an item and a
drop-down list from which user selects an item.
• You can populate the list box items either from the properties window
or at runtime. To add items to a ComboBox, select the ComboBox
control and go to the properties window for the properties of this
control.
ComboBox

• Let's create a combo box by


dragging a ComboBox control
from the Toolbox and dropping it
on the form.
Example
Add the code in editor window-
2. CheckedListBox

• The CheckedListBox control gives


you all the capability of a list box
and also allows you to display a
check mark next to the items in
the list box.
• You can add individual items to
the list with the Add method. The
CheckedListBox object support 3
states through the check state
enumeration: checked,
intermediate and unchecked.
Example
Examples:

The CheckedListBox control gives you all the


capability of a list box and also allows you to
display a check mark next to the items in the
list box.
You can add individual items to the list with
the Add method . The CheckedListBox object
supports three states through the CheckState
enumeration: Checked, Indeterminate, and
Unchecked
If you want to add objects to the list at run
time, assign an array of object references
with the AddRange method . The list then
displays the default string value for each
object.
3.Panel
• Windows Forms Panel controls are used to provide an identifiable
grouping for other controls. Typically, you use panels to subdivide a
form by function. For example, you may have an order form that
specifies mailing options such as which overnight carrier to use.
Grouping all options in a panel gives the user a logical visual cue. At
design time all the controls can be moved easily — when you move
the Panel control, all its contained controls move, too. The controls
grouped in a panel can be accessed through its controls property. This
property returns a collection of control instances, so you will typically
need to cast a control retrieved this way to its specific type.
Panel (Overview)
4. MaskedTextBox

• A MaskedTextBox control provides a


validation mechanism for user input
on a Form. For example, if you want
a TextBox to accept a date in
mm/dd/yyyy format, you can set
masking in the MaskedTextBox.
• We can create a MaskedTextBox
control using a Forms designer at
design-time or using the
MaskedTextBox class in code at run-
time (also known as dynamically).
Creating a MaskedTextBox
We can create a MaskedTextBox control using a Forms designer at design-time or using the MaskedTextBox class in code at
run-time (also known as dynamically).
To create a MaskedTextBox control at design-time, you simply drag and drop a MaskedTextBox control from Toolbox to a Form
in Visual Studio. After you drag and drop a MaskedTextBox on a Form, the MaskedTextBox looks like Figure 1. Once a
MaskedTextBox is on the Form, you can move it around and resize it using mouse and set its properties and events.
The first step to create a dynamic MaskedTextBox is to create an instance of MaskedTextBox class. The following code snippet
creates a MaskedTextBox control object.
• MaskedTextBox dynamicMaskedTextBox = newMaskedTextBox();  
In the next step, you may set properties of a MaskedTextBox control. The following code snippet sets background color,
foreground color, Text, Name, and Font properties of a MaskedTextBox.
• dynamicMaskedTextBox.BackColor = Color.Red;  
• dynamicMaskedTextBox.ForeColor = Color.Blue;  
• dynamicMaskedTextBox.Text = "I am Dynamic MaskedTextBox";  
• dynamicMaskedTextBox.Name = "DynamicMaskedTextBox";  
• dynamicMaskedTextBox.Font = newFont("Georgia", 16);
Masking Related Properties
The following code snippet sets the Mask property at run-time.
dynamicMaskedTextBox.Mask = "00/00/0000";  
Here is a list and description of masking characters.
0 – Digit, required. Value between 0 and 9.
9 – Digit or space, optional.
# - Digit or space, optional. If this position is blank in the mask, it
will be rendered as a space in the Text property.
L - Letter, required. Restricts input to the ASCII letters a-z and A-Z.
? - Letter, optional. Restricts input to the ASCII letters a-z and A-Z.
& - Character, required.
C - Character, optional. Any non-control character.
A - Alphanumeric, required.
a - Alphanumeric, optional.
. - Decimal placeholder.
, - Thousands placeholder.
: - Time separator.
Masking Related Properties
/ - Date separator.
$ - Currency symbol.
< - Shift down. Converts all characters that follow to lowercase.
> - Shift up. Converts all characters that follow to uppercase.
| - Disable a previous shift up or shift down.
\ - Escape. Escapes a mask character, turning it into a literal. "\\" is
the escape sequence for a backslash.
All other characters - Literals. All non-mask elements will appear
as themselves within MaskedTextBox. Literals always occupy a
static position in the mask at run time, and cannot be moved or
deleted by the user.
MaskFull:

MaskFull property represents if the mask values are completed.


if (maskedTextBox1.MaskFull){}  
BeepOnError:

If set true, the system beep is generated when incorrect values


are entered.
dynamicMaskedTextBox.BeepOnError = true; 
5. RadioButton

• A RadioButton or option button enables the user to select a single


option from a group of choices when paired with other RadioButton
controls.
• The RadioButton control can display text, an image , or both. Use the
checked property to get or set the state of RadioButton.
RadioButton

• Let's create three radio buttons by


dragging RadioButton controls
from the Toolbox and dropping on
the form.
Example
• In the following example, let us create two groups of radio buttons
and use their CheckedChanged events for changing the BackColor and
ForeColor property of the form.
Let's double click on the radio buttons and
put the follow code in the opened window.
6.List View
• The ListView control is used to display a list of items. Along with the
TreeView control, it allows you to create a Windows Explorer like
interface.
• The ListView control comes with lots of different properties which you
can modify manually.
• You can change its location with the help of mouse.
ListView

• Let's click on a ListView control


from the Toolbox and place it on
the form.
Example of ListView
• In this example, let us create a list view at runtime. Let's double click
on the Form and put the follow code in the opened window.
Example of ListView
• When the above code is executed and run using Start button available
at the Microsoft Visual Studio tool bar, it will show the following
window −
7.MonthCalender
• The Windows Forms MonthCalendar control presents an intuitive
graphical interface for users to view and set date information. The
control displays a grid containing the numbered days of the month,
arranged in columns underneath the days of the week. You can select
a different month by clicking the arrow buttons on either side of the
month caption. Unlike the similar DateTimePicker control, you can
select a range of dates with this control; however, the DateTimePicker
 control allows you to set times as well as dates.
MonthCalendar

• Let's create three radio buttons by


dragging MonthCalendar controls
from the Toolbox and dropping on
the form.

You might also like