0% found this document useful (0 votes)
4 views

C# Chapter 1

The document provides an introduction to programming with C#, covering key topics such as Windows Forms basics, event handling, and database connectivity. It outlines the objectives of the course, the components of the .NET Framework, and the Visual Studio IDE used for development. Additionally, it explains concepts like event-driven programming and the structure of C# applications, including automatically generated code.

Uploaded by

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

C# Chapter 1

The document provides an introduction to programming with C#, covering key topics such as Windows Forms basics, event handling, and database connectivity. It outlines the objectives of the course, the components of the .NET Framework, and the Visual Studio IDE used for development. Additionally, it explains concepts like event-driven programming and the structure of C# applications, including automatically generated code.

Uploaded by

Salman Sead
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Programming with Visual C#

Chapter 1
Introduction to Programming with C#
Course objective
1. Understand Windows Forms Basics:
2. Utilize Common Windows Forms Controls
3. Event Handling in Windows Forms
4. Database Connectivity
5. Error Handling
6. User Authentication
7. Reporting Services
8. Deployment
Course topic
 Basic Windows Controls
 Menus, dialog boxes and Message Boxes.
 Multiform and Database Applications
 Crystal reports
 Advanced UI design using Dev Express
Course textbook
Chapter 1
Introduction to Programming with C#
Chapter outline
About C#
.NET Framework

The Visual Studio IDE

The Windows Graphical User Interface

Event driven programming

Writing C# Programs

Automatically Generated Code


What is C#?
 It is an object-oriented programming language
created by Microsoft that runs on the .NET
Framework.
 C# is used for
• Mobile applications (Xamarin.Forms or MAUI)
• Desktop applications (WinForms & WFP )
• Web applications (ASP.NET )
• Games (Unity)
 .Others
.NET Framework
 The .NET Framework is a software development
framework developed by Microsoft that provides a
runtime environment and a set of libraries and
tools for building and running applications on
Windows operating systems.
.NET Framework Components
 The framework includes a variety of
programming languages, such as C#, F#,
and Visual Basic, and supports a range of
application types, including desktop, web,
mobile, and gaming applications.
.NET Framework (Cont..)
The Visual Studio IDE
 The Visual Studio is where you create and test your
C# projects.
 A development environment such as Visual Studio
is called an integrated development environment
( IDE ) .
 The IDE consists of various tools, including a form designer,
which allows you to visually create a form; an editor, for
entering and modifying program code; a compiler, for
translating the C# statements into the intermediate machine
code; a debugger, to help locate and correct program errors.
Visual Studio Editions
 Community Editions (Free)
 Professional Editions
 Enterprise Editions
Visual Studio IDE
The Windows Graphical User Interface
 Microsoft Windows uses a graphical user interface
 The Windows GUI defines how the various
elements look and function.
 As a C# programmer, you have available a
toolbox of these elements. You will create new
windows, called forms . Then you will use the
toolbox to add the various elements, called
controls
Graphical user interfaces for application programs
designed with C# and Windows Forms.
Empty Windows Form
The Toolbox
Event driven programming
 Event-driven programming is an approach in
which code is written to respond to events.
 Events can be triggered by users, such as by
clicking on an icon or entering some text.
Demonstration of Event driven programming
Writing C# Programs
 When you write a C# application, you follow a three-step
process for creating the project.

1. Define the user interface


2. Set the properties .
3. Write the code
Design the User Interface
 The first step in planning is to design the user
interface.
Set Properties
Writing Code
C# Application Files
Automatically Generated Code
 The Using Statements
 The Namespace Statement
 The Class Statement
The Using Statements
 The using statements appear at the top of the file
after the comments that you wrote.
 Using statements provide references to standard
groups of classes from the language library.
 For example, the statement using
System.Windows. Forms; allows your program to
refer to all of the Windows controls that appear in
the toolbox
The Namespace Statement
 Namespace provides a way to refer to
programming components by location or
organization.
 In the Label example in the preceding section,
“Label” is the class and “System.Windows.Forms”
is the namespace, or library grouping where
“Label” is found.
The Class Statement
 In object-oriented programming, code is organized into
classes.
 A new class can be based on (inherit from) another class,
which gives the new class all of the properties and
methods of the original class (the base class).
 When you create a new form, you declare a new class , the
new class inherits from the Form base class, which makes
your new form behave like a standard form.
Automatically Generated Code
(Example)
Thank you

You might also like