Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
431 views

Unit - 1 & 3 (C# Programming BCA - 4)

The document provides an overview of programming with C# and the .NET framework. It discusses key features of C# like being object-oriented, type-safe, and interoperable. It also describes core .NET components like the Common Language Runtime, Base Class Library, Common Type System, and Visual Studio integrated development environment. The document is intended as an introduction to programming concepts for students learning C# and .NET.

Uploaded by

aagathsakshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
431 views

Unit - 1 & 3 (C# Programming BCA - 4)

The document provides an overview of programming with C# and the .NET framework. It discusses key features of C# like being object-oriented, type-safe, and interoperable. It also describes core .NET components like the Common Language Runtime, Base Class Library, Common Type System, and Visual Studio integrated development environment. The document is intended as an introduction to programming concepts for students learning C# and .NET.

Uploaded by

aagathsakshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Programming With C#.

NET
B.C.A. (Semester – 4)

By :
Dr. BHAVESH K. LUKKA
M.Sc., Ph.D. (Comp. Science)
Assistant Professor,
Dr. V. R. Godhaniya College Of
Engineering & Technology
Porbandar

References :

 .NET Programming Black Book [ISBN-10 : 9788177227406]


 www.tutorialspoint.com/csharp/
Introduction to C#.NET

C# is a general-purpose, type-safe, object-oriented programming language. The goal of the


language is programmer productivity. To this end, C# balances simplicity, expressiveness, and
performance. The chief architect of C# language is Anders Hejlsberg since its first version.

C# is a rich implementation of the object-orientation paradigm, which


includes encapsulation, inheritance, and polymorphism. Encapsulation means creating a
boundary around an object, to separate its external (public) behavior from its internal (private)
implementation details.

C# is the most powerful programming language among all programming languages available in
the .NET framework because it contains all the features of C++, VB.NET, and JAVA, and also has
some additional features. The .NET Framework Redistributable package contains everything
needed to run a program under the .NET Framework. It includes the Common Language Runtime
(CLR), CTS, CLS etc…

Although C# constructs closely follow traditional high-level languages, C and C++ and being an
object-oriented programming languages. It has a strong resemblance with Java, it has
numerous strong programming features that make it endearing to a number of programmers
worldwide. Following is the list of a few important features of C# −

1. Simple: C# is a simple language in the sense that it provides a structured approach (to
break the problem into parts), a rich set of library functions, data types, etc.

2. Modern Programming Language: C# programming is based upon the current trend and it is
very powerful and simple for building scalable, interoperable, and robust applications.

3. Object-Oriented: C# is an object-oriented programming language. OOPs makes


development and maintenance easier whereas in Procedure-oriented programming
language it is not easy to manage if code grows as the project size grows.

4. Type-Safe: C# type safe code can only access the memory location that it has permission to
execute. Therefore, it improves the security of the program.

5. Interoperability: The interoperability process enables the C# programs to do almost


anything that a native C++ application can do.

6. Scalable and Updateable: C# is an automatic scalable and updateable programming


language. For updating our application, we delete the old files and update them with new
ones.
7. Component Oriented: C# is a component-oriented programming language. It is the
predominant software development methodology used to develop more robust and highly
scalable applications.

8. Structured Programming Language: C# is a structured programming language in the sense


that we can break the program into parts using functions. So, it is easy to understand and
modify.

9. Rich Library: C# provides a lot of inbuilt functions that make development fast.

10. Fast Speed: The compilation and execution time of the C# language is fast.

 Different Types of Applications are developed using C#.NET.

1. Windows Applications

2. Web Applications

3. Restful Web Services

4. SOAP Based Services

5. Console Applications

6. Class Library, ETC.

 What is the Visual Studio?

Visual Studio is one of the Microsoft IDE tools. Using this tool, we can develop, build,
compile, publish and run applications with the .NET framework. This tool provides some
features such as

1. Editor

2. Compiler

3. Interpreters, and Many More


VB.NET Managed Other
C# ASP.NET
C++ .Net

Common Language Specification (CLS) / (CTS)

Web Services Desktop & Other Services


( Web Forms ) ( Windows Forms )
VISUAL
STUDIO
ADO.NET (Data and Xml)
.NET

Base Class Library (BCL)

Common Language Runtime (CLR)

Operating System

THE .NET PLATFORM ARCHITECTURE

Components of .Net Framework

 Common Type System (CTS)—Common Type System (CTS) describes how types are declared,
used and managed. CTS facilitate cross-language integration, type safety, and high
performance code execution.
.NET Framework introduces a Common Type System, or CTS. The CTS specification defines
all the possible data types and programming constructs supported by the CLR and how they
may or may not interact with each other conforming to the Common Language Infrastructure
(CLI) specification. Because of this feature, .NET Framework supports the exchange of types
and object instances between libraries and applications written using any conforming .NET
language.
 Common Language Specification (CLS)—. The CLS is a specification that defines the rules to
support language integration. This is done in such a way, that programs written in any
language (.NET compliant) can interoperate with one another. This also can take full
advantage of inheritance, polymorphism, exceptions, and other features.

 Base Class Library—The Base Class Library consists of several thousand type definitions, where
each type exposes some functionality. It contains a huge library of reusable types, classes,
interfaces, structures and enumerated values, which are collectively called types, the CLR and the
Base Class Library allow developers to build the following kinds of applications:
 Web Services : Components that can be accessed over the Internet very easily.
 Web Forms : HTML based applications (Web Sites).
 Windows Forms : Rich Windows GUI applications. Windows form applications can
take advantage of controls, mouse and keyboard events and can talk directly to the
underlying OS.
 Windows Console Applications : Compilers, utilities and tools are typically
implemented as console applications.
 Windows Services : It is possible to build service applications controllable via the
Windows Service Control Manager (SCM) using the .NET Framework.
 Component Library : .NET Framework allows you to build stand-alone components
(types) that may be easily incorporated into any of the above mentioned application
types.

 Common Language Runtime — CLR (Common Language Runtime) is considered as the heart of
the .NET framework. It serves as the execution engine. The .NET applications are compiled to
a common language known as Microsoft Intermediate Language or “IL”. The CLR, then,
handles the compiling the IL to machine language, at which point the a program is executed.
It performs memory management, exception handling, debugging, security checking, thread
execution, code execution, code safety, verification and compilation.

 ADO .NET (DATA AND XML)— ADO.NET is the next generation of Microsoft ActiveX Data
Object (ADO) technology. ADO.NET is heavily dependent on XML for representation of
data. It also provides an improved support for the disconnected programming model.
ADO.NET’s DataSet object, is the core component of the disconnected architecture of
ADO.NET. The DataSet can also be populated with data from an XML source, whether it
is a file or an XML stream.
 Visual Studio — This optional development tool contains a rich set of productivity and
debugging features. Visual Studio is one of the Microsoft IDE tools. Using this tool, we
can develop, build, compile, publish and run applications with the .NET framework. This
tool provides some features such as
1. Code Editor

2. Compiler

3. Interpreters, and Many More

DIFFERENT COMPONETS (WINDOWS) OF VISUAL STUDIO IDE :-

Code Editor

Windows Forms Designer


Properties Window

Solution Explorer
Server Explorer

Tool Box Window


Assembly and Metadata

 The CIL code is housed in CLI assemblies. As mandated by the specification, assemblies are
stored in the Portable Executable (PE) format, common on the Windows platform for
all DLL and EXE files.

 Metadata is Data about Data that contains complete name of an assembly contains its
simple text name, version number, culture.

JIT (JUST-IN-TIME) COMPILER :

 In the .NET Framework, all the Microsoft .NET languages use a Common Language Runtime,
which solves the problem of installing separate runtimes for each of the programming
languages.

 When the Web Forms page is implicitly compiled, it is actually compiled twice. On the first
pass, it is compiled into IL. On the second pass, the assembly in IL is compiled into machine
language. This process is called Just-In-Time JIT compilation because it does not occurs
until the assembly is on the target machine. The reason you do not compile it ahead of time
is so that the specific JITter for your OS and processor type can be used. As a result, the
assembly is compiled into the fastest possible machine language code, optimized and
enhanced for your specific configuration. It also enables you to compile once and then run
on any number of operating systems.
JIT Types
In Microsoft .NET there are three types of JIT (Just-In-Time) compilers which are explained as
under:

Pre-JIT COMPILER

 Pre-JIT compiles complete source code into native code in a single compilation cycle. This
is done at the time of deployment of the application.

Econo-JIT COMPILER

 Econo-JIT compiles only those methods that are called at runtime. However, these
compiled methods are removed when they are not required.

Normal-JIT COMPILER

 Normal-JIT compiles only those methods that are called at runtime. These methods are
compiled the first time they are called, and then they are stored in cache.
 When the same methods are called again, the compiled code from cache is used for
execution.
 These methods are compiled the first time they are called, and then they are stored in
cache. When the same methods are called again, the compiled code from cache is used
for execution.

Managed Code and Unmanaged Code

Managed code runs in the Common Language Runtime. Managed Code is what VB.NET and
C# compilers create. It compiles to Intermediate Language (IL), not to machine code that
could run directly on your computer. The CIL is kept in a file called an assembly, along with
metadata that describes the classes, methods, and attributes (such as security requirements)
of the code you've created.

Unmanaged code is what you use to make before Visual Studio .NET 2002 was released.
Visual Basic 6, Visual C++ 6 all produced unmanaged code. It compiled directly to machine
code that run on the machine when you compile it—and on other machines as long as they
had the same chip, or nearly the same. It didn't get services such as security or memory
management from an invisible runtime; it got them from the operating system. And
importantly, it got them from the operating system explicitly, by asking for them, usually by
calling an API provided in the Windows SDK.
DIFFERENT TYPES OF PROJECTS IN VISUAL STUDIO IDE:-

1. Console Application

C# can be used to create applications that take input and display output at the command
line console. These applications are ideal for learning C# development because the user
interface is so simple.
Console applications are also very useful for utility programs that require little or no user
interaction.

2. Windows Form Application

These applications rely on desktop computer power to process and display high-
performance content.
Some Windows Form Applications might be entirely self-contained and perform whole
processing on the user's computer. Games are often codded in this way. Other applications
might be a part of a larger system and use the desktop computer primarily for processing
user input.

3. Class Library

A key feature of the .NET Framework is the base class library. The .NET Framework class
library is made up of namespaces. Each namespace contains types that you can use in your
program: classes, structures, enumerations, delegates, and interfaces.
When you create a Visual Basic or Visual C# project in Visual Studio, the most common base
class DLLs (assemblies) are already referenced. However, if you have to use a type that is in
a DLL not already referenced, you will have to add a reference to the DLL.

4. Windows Form Control Library

The Windows Control Library project template is used to create custom controls to use on
Windows Forms.

5. ASP.NET Web Application

You use ASP.NET Web Forms to create applications that primarily have a browser user
interface
Web Forms applications are platform-independent—that is, they are "reach" applications.
Users can interact with your application regardless of what type of browser they have and
even what type of computer they are using.

6. Mobile Applications etc…

We can also develop mobile applications and many more with the help of .NET… …
Data Type Tree
Boxing and Unboxing

The concept of Boxing and Unboxing is related with Value Type and Reference Type. See the example
bellow to get the idea about it.

Sometimes we need to convert Value-Type to Reference-Type is known as boxing.


Implicit conversion of a value type (int, char etc.) to a reference type (object), is known as Boxing. In boxing
process, a value type is being allocated on the heap rather than the stack.

Converting an object type back to value type is known as Unboxing.


Explicit conversion of same reference type (which is being created by boxing process); back to a value type
is known as unboxing. In unboxing process, boxed value type is unboxed from the heap and assigned to a
value type which is being allocated on the stack.
CHAPTER (UNIT) : 3rd

Windows Form

Windows Forms is a Graphical User Interface (GUI) class library which is bundled in .Net
Framework. Its main purpose is to provide an easier interface to develop the applications for
desktop, tablet, PCs. It is also termed as the WinForms. The applications which are
developed by using Windows Forms or WinForms are known as the Windows Forms
Applications that runs on the desktop computer. WinForms can be used only to develop the
Windows Forms Applications not web applications. WinForms applications can contain the
different type of controls like labels, list boxes, tooltip etc.

The events in the lifecycle of a Form from the time it is launched to the time it is closed
arelisted below:

Life Cycle of Form

Move This event occurs when the form is moved. Although by default, when a
form is instantiated and launched, the user does not move it, yet this
event is triggered before the Load event occurs.

Load This event occurs before a form is displayed for the first time.

VisibleChanged This event occurs when the Visible property value changes.

Activated This event occurs when the form is activated in code or by the user.

Shown This event occurs whenever the form is first displayed.

Paint This event occurs when the control is redrawn.

Deactivate This event occurs when the form loses focus and is not the active form.

Closing This event occurs when the form is closing.

Closed This event occurs when the form is being closed.


Properties of Form

AcceptButton Gets or sets the button on the form that is clicked when the user presses
the ENTER key.
CancelButton Gets or sets the button control that is clicked when the user presses the
ESC key.
MaximizeBox Gets or sets a value indicating whether the Maximize button is displayed
in the caption bar of the form.
MinimizeBox Gets or sets a value indicating whether the Minimize button is displayed in
the caption bar of the form.
ControlBox Gets or sets a value indicating whether a control box is displayed in the
caption bar of the form.
Menu Gets or sets the Main Menu that is displayed in the form.
Opacity Gets or sets the opacity level of the form.
ShowInTaskbar Gets or sets a value indicating whether the form is displayed in the
Windows taskbar.
StartPosition Gets or sets the starting position of the form at run time.
CenterParent, CenterScreen, Manual, WindowsDefaultBounds,
WindowsDefaultLocation
WindowState Gets or sets a value that indicates whether form is minimized, maximized,
or normal.
IsMDIContainer Gets or sets a value indicating whether the form is a container for
multiple-document interface (MDI) child forms.
Common Control Properties

Properties Description
BackColor Gets or sets the background color of the control.
BackgroudImage Gets or sets the background image displayed in the control.
Cursor Gets or sets the cursor that is displayed when the mouse pointer is
over the control.
Enabled Gets or sets a value indicating whether the control can respond to
userinteraction.
Font Gets or sets the font of the text displayed by the control.
ForeColor Gets or sets the foreground color of the control.
Height Gets or sets the height of the control.
Name Gets or sets the name of the control.
Size Gets or sets the height and width of the control.
TabIndex Gets or sets the tab order of the control within its container.
TabStop Gets or sets a value indicating whether the user can give the focus to
thiscontrol using the TAB key.
Text Gets or sets the text associated with this control.
Visible Gets or sets a value indicating whether the control and all its child
controls are displayed.
Width Gets or sets the width of the control.
Common Control Events

Click Occurs when the control is clicked.


Enter Occurs when the control is entered.
Leave Occurs when the control leaves the focus.
KeyDown Occurs when a key is pressed while the control has focus.
KeyPress Occurs when a key is pressed while the control has focus.
KeyUp Occurs when a key is released while the control has focus.
MouseClick Occurs when the control is clicked by the mouse.
MouseDown Occurs when the mouse pointer is over the control and a mouse button
is pressed.
MouseEnter Occurs when the mouse pointer enters the control.
MouseHover Occurs when the mouse pointer rests on the control.
MouseLeave Occurs when the mouse pointer leaves the control.
MouseMove Occurs when the mouse pointer is moved over the control.
MouseUp Occurs when the mouse pointer is over the control and a mouse button
is released.
MouseWheel Occurs when the mouse wheel moves while the control has focus.
TOOL-BOX CONTROLS

TextBox Control
(System.Windows.Forms.TextBox)

Properties of TextBox

Multiline Values: True, False


Gets or sets a value indicating multiline

AcceptsReturn Values: True, False


Gets or sets a value indicating whether pressing ENTER in amultiline
TextBox control creates a new line of text in the control or activates the default
button for the form.
AcceptsTab Values: True, False
Gets or sets a value indicating whether pressing the TAB key in amultiline text
box control types a TAB character in the control instead of moving the focus to
the next control in the tab order.
WordWrap Values: True, False
Indicates whether a multiline text box control automatically wraps
The words to the beginning of the next line when necessary.
ScrollBars Values: None, Horizontal, Vertical, Both
Gets or sets which scroll bars is to set into the multiline TextBox control.

CharacterCasing Values: Normal, Upper, Lower


Gets or sets whether the TextBox control modifies the case of characters as they
are typed.
ReadOnly Values: True, False
Gets or sets a value indicating whether text in the text box is read-only.
PasswordChar Gets or sets the character used to mask characters of a password in a single-line
TextBox control.
MaxLength Gets or sets the maximum number of characters the user can type orpaste
into the text box control.
SelectedText Gets or sets a value indicating the currently selected text in the control.

Methods of TextBox

AppendText(), Clear(), SelectAll(), DeselectAll(), Cut(), Copy(), Paste(), Undo()


Event of TextBox

TextChanged Occurs when the Text property value changes.

KeyPress Occurs when control got focus and user press or release any key

KeyDown Occurs when a key is first pressed

KeyUp Occurs when a key is released

RichTextBox
(System.Windows.Forms.RichTextBox)

Properties

TextLength Gets the length of text in the control.


WordWrap Indicates whether a multiline text box control automatically wraps
words to the beginning of the next line when necessary.
SelectedText Gets or sets the selected text within the RichTextBox.
SelectionStart Gets or sets the starting point of text selected in the text box.
SelectionLength Gets or sets the number of characters selected in control.
SelectionFont Gets or sets the font of the current text selection or insertion point.
SelectionColor Gets or sets the text color of the current text selection or insertion point.
SelectionBackColor Gets or sets the color of text when the text is selected
in a RichTextBox control.
Method

Cut(), Copy(), Paste(), Undo(), Redo(), SelectAll(), DeselectAll()

LoadFile LoadFile(String path, RichTextBoxStreamType type)


Loads a specific type of file into the RichTextBox control.

SaveFile SaveFile(String path, RichTextBoxStreamType type)


Saves the contents of a RichTextBox control to an open data stream.

HScrollBar & VScrollBar


(System.Windows.Forms.HScrollBar, System.Windows.Forms.VScrollBar)

Properties

Maximum Default Value – 100. Gets or sets the upper limit of values of the
scrollable range.
Minimum Default Value – 0. Gets or sets the lower limit of values of the scrollable range.
Value Default Value - 0
Gets or sets a numeric value that represents the current position of the
scroll box on the scroll bar control.
SmallChange Default Value - 1
Gets or sets the value to be added to or subtracted from the Value
property when the scroll box is moved a small distance.
LargeChange Default Value - 10
Gets or sets a value to be added to or subtracted from the Value property
when the scroll box is moved a large distance.

Events

Scroll - Occurs when the scroll box has been moved by either a mouse or keyboard action.
ListBox
(System.Windows.Forms.ListBox)

Properties

SelectionMode None, One, MultiSimple, MultiExtended


SelectedItem Gets or sets the currently selected item in the ListBox.
SelectedIndex Gets or sets the zero-based index of the currently selected item in
a ListBox
Items Gets the items of the ListBox.
Count
Indexer (this[int])
Add()
Insert()
Remove()
RemoveAt()
Sorted True, False
SelectedIndices Gets a collection that contains the zero-based indexes of all
Count currently selected items in the ListBox.
Indexer (this[int])
SelectedItems Gets a collection containing the currently selected items in
Count the ListBox.
Indexer (this[int])

Method
FindString() Finds the first item in the ListBox that starts with the specified

ClearSelected() Unselects all items in the ListBox.

SetSelected() Selects or clears the selection for the specified item in a ListBox.

Events
SelectedIndexChanged
MenuStrip
(System.Windows.Forms.MenuStrip)

Three Items you can add ComboBox, MenuItem, TextBox

ShortcutKeys You can specify shortcut key in menu item


ShowShortcutKeys Specify whether you want to show short-cut keys or not
CheckOnClick Gets or sets a value indicating whether the Tool Strip Menu Items should
automatically appear Checked and Unchecked when clicked.

DisplayStyle Image And Text, Text, Image, None

RadioButton Control
(System.Windows.Forms.RadioButton)

Radio Button generally used as group. Sometimes refers as option buttons. You can use
panel or group box control to generate group of radio buttons.

Properties

AutoEllipsis True, False

Gets or sets a value indicating whether the ellipsis character (...) appears at the
right edge of the control, denoting that the control text extends beyond the
specified length of the control.

AutoCheck True, False

Gets or sets a value indicating whether the Checked value and the appearance
of the control automatically change when the control is clicked.

Appearance Normal, Button

Gets or sets a value determining the appearance of the RadioButton.

Checked True, False

Gets or sets a value indicating whether the control is checked.

Events
CheckedChanged Occurs when the value of the Checked property changes.
CheckBox Control
(System.Windows.Forms.CheckBox)

Properties

AutoEllipsis True, False

Gets or sets a value indicating whether the ellipsis character (...) appears at the
right edge of the control, denoting that the control text extends beyond the
specified length of the control.
Checked True, False

Gets or set a value indicating whether the CheckBox is in the checked state.
CheckState Unchecked, Checked, Indeterminate
Gets or sets the state of the
CheckBox.
ThreeState True, False
Gets or sets a value indicating whether the CheckBox will allow three check
states rather than two.

Event

CheckedChanged Occurs when the value of the Checked property changes.


TreeView
(System.Windows.Forms.TreeView)

Properties

Nodes Gets the collection of tree nodes that are assigned to the tree
Property: Count view control.
Indexer: this[int32]
Methods: Add()
Insert()
Remove()
RemoveAt(
)
Clear()
SelectedNode Gets or sets the tree node that is currently selected in the
Properties FirstNode treeview control.
FullPat
h Index
LastNode
ShowLines True, False
ShowPlusMinus True, False
PathSeparator ‘/’

Events

AfterSelect
AfterCollapse, BeforeCollapse
AfterExpand, BeforeExpand

PictureBox
(System.Windows.Forms.PictureBox)

Properties

Image Path/Location
SizeMode Normal, StretchImage, AutoSize, CenterImage, Zoom
ComboBox
(System.Windows.Forms.ComboBox)

Properties

Items Gets an object representing the collection of the items contained in


this ComboBox.
DropDownStyle Simple , DropDown, DropDownList
Sorted True, False
Text Gets or sets the text associated with this control.
SelectedIndex Gets or sets the index specifying the currently selected item.
MaxDropDownItems 8
SelectedItem Gets or sets currently selected item in the ComboBox.

Methods

FindString(string s) Add() Insert() Remove() RemoveAt() Clear()

Events
SelectedIndexChanged
Timer
(System.Windows.Forms.Timer)

A Timer is used to raise an event at user-defined intervals. Whenever the Enabled


property is set to true and the Interval property is greater than zero, the Tick event is
raised at intervals based on the Interval property setting.

Properties

Interval Default Value – 100

Gets or sets the time, in milliseconds, before the Tick event is raised relative to the last
occurrence of the Tick event.

Enabled True, False

Gets or sets whether the timer is running.

Events
Tick Occurs when the specified timer interval has elapsed and the timer is enabled.

Methods
Start() Starts the timer.

Stop() Stops the timer.


Panel
(System.Windows.Forms.Panel)

The Panel control is a container control that is used to host a


group of similar child controls.

You can use Panel control when you have to show and hide a
group of controls.

Properties

AutoScroll True, False


Gets or sets a value indicating whether the container enables the
user toscroll to any controls placed outside of its visible boundaries.
BorderStyle Indicates the border style for the control.
AutoScroll Gets or sets a value indicating whether the container enables the user
to scroll to any controls placed outside of its visible boundaries.
AutoSize Gets or sets a value that indicates whether the control resizes based on its
contents.
BackColor Gets or sets the background color for the control.

BackgroundImage Gets or sets the background image displayed in the control.

BorderStyle Indicates the border style for the control.

ContextMenuStrip Gets or sets the ContextMenuStrip associated with this control.

Controls Gets the collection of controls contained within

Methods
Add(), Clear(), Contains(), Hide(), Show()
GroupBox
(System.Windows.Forms.GroupBox)

A GroupBox control is a container control that is used to place Windows Forms child controls
in a group.

Properties :

Text Gets or sets the text associated with this control.


Controls Gets the collection of controls contained within the control.

Methods :
Add(), Clear(),Remove(),
RemoveAt(), Contains()

Panel Vs. GroupBox

Panel GroupBox
The Panel control can display the scroll bar. The GroupBox control cannot display the
Panels have auto scroll property. scroll bar.
A Panel control can’t be placed with A GroupBox control can be placed with atitle
a title (text). (text).
Panel’s border is determined by its A GroupBox always displays a border.
BorderStyle property.
It has the double click event. It does not have the click event.
It has also got MouseMove, MouseDown, The events that are missing include
MouseUp events.. MouseMove, MouseDown, MouseUp events..

Inherit from Direct Inherit from


System.Windows.Forms.ScrollableControl System.Windows.Forms.Control
Programming With C#.NET BCA - 4th

Dialog Boxes

 OpenFileDialog

(System.Windows.Forms.OpenFileDialog)

Title Get or set title of


dialog.

Filter Gets or sets a filter string that specifies the file types
and descriptions todisplay in the OpenFileDialog.

FileName Gets a FileInfo object for the selected file. If multiple


files are selected,returns the first selected file.

MultiSelect Gets or sets a value that indicates whether the


OpenFileDialog allowsusers to select multiple files.
FileNames Gets a collection of FileInfo objects for the selected files.

 SaveFileDialog

(System.Windows.Forms.SaveFileDialog)

Filter Gets or sets a filter string that specifies the file


types and descriptions todisplay in the
SaveFileDialog
CheckFileExists Gets or sets a value indicating whether the dialog
box displays a warningif the user specifies a file
name that does not exist.
Title Gets or sets the file dialog box title.
FileName Gets or sets a string containing the file name
selected in the file dialog box.
OverwritePropmpt Gets or sets a value indicating whether the Save As
dialog box displays awarning if the user specifies a
file name that already exists.

Page | 29
Programming With C#.NET BCA - 4th

 ColorDialog
(System.Windows.Forms.ColorDialog)
Color Gets or sets the color selected by the user.
AllowFullOpen Gets or sets a value indicating whether the user can use the dialog
box todefine custom colors.

 FontDialog
(System.Windows.Forms.FontDialog)
Font Gets or sets the selected font.
Color Gets or sets the selected font color.
ShowColor Gets or sets a value indicating whether the dialog box displays the
color choice.

Page | 30

You might also like