Академический Документы
Профессиональный Документы
Культура Документы
Of
Some COMMON ELEMENTS of BLEND
TEXT BLOCK
txtTextBlock
.Text
.ClearValue
.Visibility
.IsEnabled
.Focus
.Clear
.ClearValue
.Focus
.IsEnabled
.Text
.Visibility
TEXT BOX
txtTextBox
PASSWORD BOX
txtPasswordBox
.Clear
.ClearValue
.Focus
.IsEnabled
.Password
.ToString
.Visibility
LIST BOX
lstListBox
.Focus
.IsEnabled
.Items .Add
.Clear
.Count
.IndexOf
.Item
.Remove
.RemoveAt
.SelectedIndex
: Gets or Sets the Index of the first item in the current selection or
returns negative one (-1) if the selection is empty
.SelectedItem
: Gets or Sets the Index of the first item in the current selection or
returns negative one (-1) if the selection is empty
.SelectedItems
.SelectedValue
.SelectionMode
: Gets or Sets the selection behaviour for the List Box Items
.Visibility
COMBO BOX
cboComboBox .Focus
.IsEditable
.IsEnabled
.Items .Add
.Clear
.Count
.IndexOf
.Item
.Remove
.RemoveAt
: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box--------
.SelectedIndex
.SelectedItem
.SelectedItems
.SelectedValue
.SelectionMode
.Text
.Visibility
BUTTON
cmdButton
.Content
.Focus
.IsEnabled
.Visibility
.Children
.Add
.Clear
.Count
.IndexOf
.Item
.Remove
.RemoveAt
GRID
grdGrid
: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box--------
.Focus
.IsEnabled
.Visibility
CHECK BOX
chkCheckBox
.Content
: ------same as Button--------
.Focus
.IsChecked
.IsEnabled
.Visibility
RADIO BUTTON
rdbRadioButton
.Content
: ------same as Button--------
.Focus
.IsChecked
.IsEnabled
.Visibility
DATA GRID
dgDataGrid
.Focus
.IsEnabled
.Items .Add
.Clear
.Count
.IndexOf
.Item
.Remove
.RemoveAt
: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box--------
.SelectedItem
.SelectedItems
.SelectedValue
.SelectionMode
.Visibility
.DisplayDate
.DisplayMode
.Focus
.IsEnabled
.SelectedDate
.SelectedDates
.SelectionMode
.ToString
.Visibility
. Visibility
.Focus
.IsEnabled
.SelectedDate
: ------same as Calendar--------
.SelectionMode
: ------same as Calendar--------
.Text
CALENDAR
calCalendar
DATE PICKER
dtDatePicker
.ToString
: ------same as Calendar--------
.Visibility
STACK PANEL
stkStackPanel .Children
.Add
.Clear
.Count
.IndexOf
.Item
.Remove
.RemoveAt
: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box-------: ------same as List Box--------
.Focus
.IsEnabled
. Visibility
WRAP PANEL
wrpWrapPanel .Children
.Add
.Clear
.Count
.IndexOf
.Item
.Remove
.RemoveAt
: ------same as Stack Panel-------: ------same as Stack Panel -------: ------same as Stack Panel -------: ------same as Stack Panel -------: ------same as Stack Panel -------: ------same as Stack Panel -------: ------same as Stack Panel --------
.Focus
.IsEnabled
. Visibility
USER CONTROL
ctrUserControl
COLLECTION
colCollection
.Add
.Remove
.Count
.Clear
COLLECTIONS
In general terms, a collection is an object used for grouping and managing related objects. Visual Basic .Net
Collections are data structures that holds data in different ways for flexible operations and is an ordered set
of items that can be referred to as a unit. Visual Basic also provides a Collection class, with which you can
define and create your own collections. The Collection class also provides you with the built-in functionality
to loop through elements using For Each...Next and to retrieve elements by index.
A collection can be zero-based or one-based, depending on what its starting index is. The former
means that the index of the first item in the collection is 0, and the latter means that it is 1. An
example of a zero-based collection is the .NET Framework Controls collection, discussed earlier
on this page. The Visual Basic Collection object is an example of a one-based collection.
One-based collections can be more intuitive to Visual Basic users, because the index ranges from 1
through the value of the Count Property (Collection Object), which returns the number of items in a
collection.
Instances of the Visual Basic Collection class allow you to access an item using either a numeric
index or a String key. You can add items to Visual Basic Collection objects either with or without
specifying a key. If you add an item without a key, you must use its numeric index to access it.
The Visual Basic Collection object is a general-purpose programming tool; it is more flexible than
some other collections. It has an Add Method (Collection Object) for putting items into the
collection and a Remove Method (Collection Object) for taking items out.
The Visual Basic Collection object provides a convenient way to refer to a related group of items as
a single object. The items, or elements, in a collection need only be related by the fact that they exist
in the collection. Elements of a collection do not have to share the same data type.
You can create a collection the same way you create other objects, as the following example
illustrates.
The properties and methods of the Collection object provide only the most basic services for
collections. For example, the Add method cannot check the type of an element being added to a
collection, which you might want to do to ensure that the collection contains only one kind of
element. If you can ensure this in the Add method, you have a strongly-typed collection, and you do
not have to convert the return from the Item property to its run-time data type. This improves your
performance.
You can provide more robust functionality and additional properties, methods, and events by
creating your own collection class.
COLLECTION VS ARRAY
Collections are very similar to arrays. They are used to store a number of values (or variables), so
that you can process them all.
There are a number of differences between arrays and collections. First difference is that the
indexing for arrays starts with zero, while for a collection it starts with 1. To understand this,
consider the image below:
Now the statement V = A(3) will place the value 55 in V because the indexing start at zero in
arrays. However the similar statement V = C(3) will place 43 instead because collection indexing is
different. The same applies for the second statement.
Another important difference is the data type. All Array elements has the same data type. So if you
have an array:
Dim A(0 To 9) As Integer
then A(0), A(1), A(2) A(9) are all Integers. Collections on the other hand do not require this. You
can store integers, reals, strings, bytes, etc. in the same collection. This can be illustrated below:
Usually you will use the same data type for all elements of the collection; however you still have
the option to use different data types whenever you need to.
Another difference between arrays and collections is that collections can add elements and remove
elements directly and change in size without any need for some kind of processing, while arrays are
fixed in size, and you cannot insert values at specific locations at random.
Finally array elements can be updated and overwritten, while collections are not. To make this clear
check out this:
In this example if you write C(3) = 55 you get an error, that is because collection does not allow
you to update or overwrite the content of an element. However there is a way to overcome this. We
will discuss this later.
Now let us see how to define a collection. There are two ways to define a collection:
Dim C As New Collection
In this example you create a collection object that is ready to be used. So you can add, remove
elements, get the number of items, or do whatever you want with the collection directly. Another
way is:
Dim C As Collection
here C is not ready yet to be used. It does not point to a collection yet. You can never use it. To be
able to use it later on in the code you should write:
C = New Collection
This will allow you to use the collection without any problem. The first method of defining a
collection is the one you will probably use the most.
Now in order to add elements to the collection you use the add method.
When you write C.Add the compiler shows you the parameters that you should provide. The ones in
the square brackets are optional. The parameters are:
Before: is the index of the item you want the new element to be inserted before.
After: is the index of the item you want the new element to be inserted after.
Next is removing elements. This simple, you just provide the index of the element you want to
remove:
C.Remove(3)
Finally we describe how to simulate the functionality replacing or updating an item in the array
using collection.
If we write :
C.Add(N, , , 7)
C.Remove(7)