You are on page 1of 4

ListBox

A list box presents a list of items to choose from. Each item displays on a line. The user makes a selection
by clicking in the list. Once clicked, the item or line on which the mouse landed becomes highlighted,
indicating that it is the current choice. Here is an example:

After an item has been selected, to make a different selection, the user would click another. The new
clicked item becomes selected or highlighted; the previously selected item looses its highlighting attribute.
The user can also change the selection by pressing the up or down arrow keys.
List boxes are categorized in two types: single and multi-selection. The second category allows a user to
select more than one item by pressing Ctrl to select items at random or by pressing Shift to select items in
a range.


One of the main reasons for using a list box is to display a list of items to the user. Sometimes the list would be very large. If the list is
longer than the available client area of the control, the control would be equipped with a scroll bar that allows the user to navigate up
and down to access all items of the list. You will have the option of deciding how many items to display on the list.


Tree View
The purpose of a TreeView control is to display information in a hierarchy. A TreeView is made up of
nodes that are related to each other in some way. Users can look at information, or objects, presented in
a TreeView control and quickly determine how those objects are bound together.
Figure 4.4 shows a good example of TreeView in the Windows Explorer. The left side of Explorer
shows information about drives in a hierarchical layout. Explorer starts its tree with a node called
Desktop. From there you can see several nodes indented below the Desktop node. The indentation and
the lines connecting nodes show that the My Computer node is a child of the Desktop node. My
Computer also has childrenthe A: drive, C: drive, and so on. Children of the same parent are often
referred to as siblings. The A: drive and B: drive, for example, both have My Computer as a parent and
are called siblings.

FIGURE 4.4 - Windows Explorer as an example of a TreeView
The TreeView control is available as part of the Common Controls component in Visual Basic. You can
use the TreeView anytime that you need to display data to a user as a hierarchy.





Rich Text Box & Text Box Control
A RichTextBox is a better choice when it is necessary for the user to edit formatted text, images, tables,
or other rich content. For example, editing a document, article, or blog that requires formatting, images,
etc is best accomplished using a RichTextBox.

A TextBox requires less system resources then a RichTextBox and it is ideal when only plain text needs to
be edited (i.e. usage in forms).

A RichTextBox mainly used if you want more control over styling the text color, type, font, alignment
ect. So anything you can do in Microsoft Word, you can do with a RichTextBox. It can be used to save or
display .rtf files with ease.

A Textbox is basically used to display or get one line input. You can have a multi-line TextBox which is
used mainly to display or get more than one one-liner and keeps you from having to manage multiple
TextBox's. Also keeps your UI a little more tidy.

An important technical difference is that TextBox supports DataBinding, RichTextBox does not, which
makes it a bit nasty to use in an MVVM application.


Differences

MDI SDI
Maximize all
documents
Maximize parent window
Can only be implemented through special
code or through a window manager that can
group windows
Switch between
documents
Using special interface inside parent
window
Through task /window manager
Multiple Desktops
You can only stretch the parent window
and try to organize individual windows
manually
Easily done
Multiple Monitors
You can only span the parent window
and try to organize individual windows
manually
Easily done
Grouping Naturally implemented
Possible only through special window
managers
Switch focus to
specific document
Easily handled Difficult to implement


Activex Exe vs Activex DLL
ActiveX DLLs and ActiveX EXEs are almost exactly the same in the ways they are built and used. In both
cases, you build one or more classes that applications can use to do something. The big difference lies in
where they are used.

An ActiveX DLL's code is executed within the main program's address space. It behaves as if the class
was created within the main program's code. Because the code lies inside the program's address space,
calling methods is very fast.

An ActiveX EXE's code is run in a separate process. When the main program calls an ActiveX EXE's
method, the system marshalls the call to translate the parameters into the ActiveX EXE's address space,
calls the method, translates the results back into the main program's address space, and returns the
result. This is slower than running an ActiveX DLL's method inside the main program's address space.

Because of the difference in speed, an ActiveX DLL is almost always preferable. The reason ActiveX EXEs
are useful is they can run on a different computer than the main program while an ActiveX DLL must run
on the same computer as the main program.

If you want to build a library of shared routines to save programming and debugging, use an ActiveX DLL
because it will give you better performance. Even if you need to distribute several copies of the DLL on
different computers, it will probably be worthwhile.

If you want a centralized server library, use an ActiveX EXE. The EXE can sit on a central computer and
work directly with that computer's resources. If you need to frequently change how the code works, you
can easily change it in one place.

You might also like