0% found this document useful (0 votes)
22 views23 pages

GUI Session15

This document discusses three main topics: 1. Using help systems in applications with context-sensitive, pop-up, and tool tip help. 2. Features of code libraries, including accessibility levels and creating libraries. 3. Integrating COM components in C# by converting unmanaged code to managed code using tlbimp.

Uploaded by

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

GUI Session15

This document discusses three main topics: 1. Using help systems in applications with context-sensitive, pop-up, and tool tip help. 2. Features of code libraries, including accessibility levels and creating libraries. 3. Integrating COM components in C# by converting unmanaged code to managed code using tlbimp.

Uploaded by

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

GUI Applications

Installing Windows XPDevelopment Using


Professional Using .NET
Attended Framework
Installation

Objectives

In this session, you will learn to:


Use the help system
Identify the features of a code library
Integrate COM components in Microsoft Visual C#

Ver. 1.0 Slide 1 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte

Using the Help System


A help system should enable even a novice to understand and
use the software.
Customized applications contain a number of features and
options to perform different operations.
The customized applications should be provided with a help
system to assist the user.
A help system provides help by using the following methods:
Context-sensitive help
Pop-up help
Tool tips

Ver. 1.0 Slide 2 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

Context-sensitive help provides a part of information that is


relevant to the current situation or feature.
Pop-up help can provide a short message to the user about
the use of a particular control without opening any other
interface.
Tool tip provides a short and quick help as the user moves the
cursor over any control.
In addition to these methods, the contents of an html file can
also be used to provide help to users.

Ver. 1.0 Slide 3 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

Displaying Help by Using the Contents of an HTML File:


The HelpProvider control can be used to provide online help for
controls on a Windows form.
An html help file can be attached to the Windows form to provide
help.
The Html help file will be displayed when user presses the F1 key.

Ver. 1.0 Slide 4 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

Identifying the Features of a Code Library


A component is a .NET assembly that can be used by an
application by adding its reference.
A code library provides a convenient way to package and
reuse components.
Components from different projects can be combined into a
single assembly.
The components in a single code library must be written in the
same programming language.
An application can use a code library irrespective of the
language used to develop the components of the library,
provided both the programming languages are CLS-compliant.

Ver. 1.0 Slide 5 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

The accessibility of a component in a code library depends


upon its access level.
A component marked with a specific access level can be
accessed in the following ways:
With public access level, a component can be accessed by any
other component.
With the friend/internal access level, a component can be
accessed only by the other members of the code library.
With the protected access level, a component can be accessed
either within the same class or by the member of a derived class.
With the private access level, a component can be accessed only
within the same class.
While designing a code library the features that are general
and are supported by other languages, should be used.

Ver. 1.0 Slide 6 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

Creating Code Libraries:


A code library can be created by creating a Class Library project in
Visual Studio and by adding existing components to this project.
New components can also be added by writing appropriate code.

Ver. 1.0 Slide 7 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

Integrating COM Components in Microsoft Visual C#


Component Object Model (COM) is a set of specifications and
services that provides the developers with the facility of
creating reusable objects and components.
COM components:
Can be implemented either as an EXE or as a DLL.
Can be developed in various programming languages.
Can be integrated with a code written in a language that is
different from the language in which the component is created.
A COM component compiled as an unmanaged code cannot
be used directly with a managed code.
Such COM components need to be converted into a .NET
compatible version.

Ver. 1.0 Slide 8 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Knowledge Byte (Contd.)

An unmanaged code can be converted to a managed code by


using a tool provided by .NET SDK, called tlbimp.
An unmanaged VB. DLL file can be converted to managed
CS.DLL file by using tlbimp command as follows:
tlbimp VB.dll /out:CSharp.dll

Ver. 1.0 Slide 9 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Best Practices

The following best practices can be considered while


throwing exceptions from components:
If it is possible for the component to handle exceptions
internally, you should write the code to handle it.
Whenever an exception is thrown for the client application to
handle, try to use specific exceptions, as possible, than using a
general exception.
Sometime it is required to create and throw custom exceptions
in a component. All such exceptions should be well
documented so that the client application should be able to
handle the exception in a proper manner.

Ver. 1.0 Slide 10 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Best Practices (Contd.)

All custom exceptions should be well documented so that the


client application should be able to handle the exception in a
proper manner.
The documentation of custom exceptions should include the
following information:
Description of the exception
Different conditions for exception to occur
Possible solutions to handle the error condition
Exception should not be thrown very frequently. They should
be thrown only when there is no way out to handle a situation.
An error code must be provided for all the exceptions thrown
by a component.

Ver. 1.0 Slide 11 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Tips and Tricks

Any line of code in the code window can be navigated by


performing following steps:
1. Press Ctrl+G. The Go To Line dialog box appears.
2. Type the line number in the Line Number text box.
3. Click the OK button. The cursor will point to the respective line
in the code.
A break point can be inserted in code by performing
following steps:
1. Place the cursor on the line where you want to insert a break
point.
2. Press the F9 key. A break point will be inserted in the code.

Ver. 1.0 Slide 12 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Tips and Tricks (Contd.)

A break point can be removed from the code by performing


following steps:
1. Place the cursor on the line from where you want to remove a
break point.
2. Press the F9 key. The break point will be removed from the
code.
In case the build of an application fails, press the F8 key to
iterate through build errors.
You can go to the definition of a method used in the code by
performing following steps:
1. Place the cursor in the code window where the method is
used.
2. Press the F12 key. The cursor will now point to the definition of
the method.

Ver. 1.0 Slide 13 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Tips and Tricks (Contd.)

Line numbering can be turned on in the code window by


performing following steps:
1. Select ToolsOptions. The Options dialog box appears.
2. Select and expand the Text Editor option in the left panel of
the Options dialog box.
3. Select the C# option.
4. Check the Line Numbers option under the Display section in
the right panel of the Options dialog box.
5. Click the OK button.

Ver. 1.0 Slide 14 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

FAQs

In a help system, how can user search for information using


the index feature?
In a help system, a user can search a topic by typing a
keyword, related to the topic, in the index-search text box. On
searching, a list of topics that are related to the keyword is
displayed. The user can select the appropriate topic to view the
details of the topic.
What do you mean by a COM component?
Component Object Model (COM) is a set of specifications and
services defined by Microsoft to create reusable components.
A COM component is created in the language–neutral way so
that a component developed in one language can be used by
an application developed in any other language. COM can be
implemented either as an executable (EXE) or as a Dynamic
Link Library (DLL).

Ver. 1.0 Slide 15 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

FAQs (Contd.)

What is the use of the HelpString on <HelpProvider


Control Name> property of a control in the Windows
form?
The HelpString on <HelpProvider Control Name>
property of a control will be visible only after adding a
HelpProvider control in the Windows form. This property is
used to determine the help string associated with the control.
Under what circumstances should we prefer out-of-process
components over in-process components?
Out-of-process component should be preferred if the memory
requirement of the component is high and frequent
communication with the component is not required.
They are also useful if the same component is shared by many
applications.

Ver. 1.0 Slide 16 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge

John is creating a .NET application using Visual C#. In a


form, he has added a Button control, named button1, and a
ToolTip control, named toolTip1. Now he wants to set the
value of the tooltiptext property for the button1 control
as “Save a record”. Which of the following code will correctly
set the tooltiptext property?
a. button1.ToolTipText = “Save a Record”
b. toolTip1.ToolTipText = “Save a Record”;
c. toolTip1.SetToolTip(button1, “Save a Record”);
d. button1.SetToolTip(toolTip1, “Save a Record”)

Answer:
c. toolTip1.SetToolTip(button1, “Save a Record”);

Ver. 1.0 Slide 17 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge (Contd.)

John is creating a .NET application using Visual C#. He has


added a ToolTip control in a Windows form to display the
tool tip for the controls present in the form. He wants to
make sure that a tool tip displays for five seconds when the
mouse pointer is stationary on a control. Which of the
following property of the ToolTip control does he need to set
to perform this activity?
a. AutomaticDelay
b. AutoPopDelay
c. InitialDelay
d. ReshowDelay

Answer:
b. AutoPopDelay

Ver. 1.0 Slide 18 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge (Contd.)

Henry is creating a .NET component named Calculations.


He wants that this component can be used inside the
assembly only. What should be the access level of the
constructor written for the Calculations component?
a. public
b. private
c. protected
d. internal

Answer:
d. internal

Ver. 1.0 Slide 19 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge (Contd.)

Henry is creating a .NET application using Visual C#. To


implement the help system in the application, he has
created a help file. He also added a HelpProvider control in
the form. Now he wants to attach the help file with the
application. Which of the following property of the
HelpProvider control he needs to set to perform this activity?
a. HelpNamespace
b. HelpKeyword
c. HelpNavigator
d. HelpString

Answer:
a. HelpNamespace

Ver. 1.0 Slide 20 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge (Contd.)

Henry is creating a .NET application using Visual C#. In a


Windows form he adds a Button control, named button1.
Now he wants to provide the popup help for button1. Identify
the correct steps to perform this activity.
a. 1. Set the MinimizeBox and MaximizeBox properties of the form to
False.
2. Set the HelpButton property of the form to true.
3. Add a HelpProvider control named helpProvider1 to the form.
4. Set the HelpString on helpProvider1 property of the button1
control to specify the help text for the control.
b. 1. Set the MinimizeButton and MaximizeButton properties of the
form to False.
2. Set the HelpButton property of the form to true.
3. Add a HelpProvider control named helpProvider1 to the form.
4. Set the HelpKeyword on helpProvider1 property of the
button1 control to specify the help text for the control.

Ver. 1.0 Slide 21 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge (Contd.)

c. 1. Set the Minimize and Maximize properties of the form to False.


2. Set the HelpButton property of the form to true.
3. Add a HelpProvider control named helpProvider1 to the form.
4. Set the HelpString on helpProvider1 property of the button1
control to specify the help text for the control.
d. 1. Set the MinimizeButton and MaximizeButton properties of the
form to False.
2. Set the HelpButton property of the form to true.
3. Add a HelpProvider control named helpProvider1 to the form.
4. Set the HelpKeyword on helpProvider1 property of the
button1 control to specify the help text for the control.

Ver. 1.0 Slide 22 of 23


GUI Applications
Installing Windows XPDevelopment Using
Professional Using .NET
Attended Framework
Installation

Challenge (Contd.)

Answer:
a. 1. Set the MinimizeBox and MaximizeBox properties of the form to
False.
2. Set the HelpButton property of the form to true.
3. Add a HelpProvider control named helpProvider1 to the form.
4. Set the HelpString on helpProvider1 property of the button1
control to specify the help text for the control.

Ver. 1.0 Slide 23 of 23

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy