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

Windows Form Application C

This document discusses building a login form application using Windows Forms in C#. It includes sections on the group members working on the project, an overview of Windows Forms applications and how they differ from web applications, using the IDE and Form1.cs to add controls and code, and how to output information and get user input. The key points are that Windows Forms allows building rich desktop interfaces with controls, events, and custom elements, and involves placing controls on forms and handling user interactions through event-based code.

Uploaded by

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

Windows Form Application C

This document discusses building a login form application using Windows Forms in C#. It includes sections on the group members working on the project, an overview of Windows Forms applications and how they differ from web applications, using the IDE and Form1.cs to add controls and code, and how to output information and get user input. The key points are that Windows Forms allows building rich desktop interfaces with controls, events, and custom elements, and involves placing controls on forms and handling user interactions through event-based code.

Uploaded by

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

WINDOWS FORM APPLICATION

C#
Project Task: Login Form

GROUP MEMBERS
NO.

NAMES

ROLL NUMBERS

MASHARI MAHMOOD

MUHAMMAD KHAN

F13BA004

SALMAN FAISAL

F13BA032

SYED MUHAMMAD GHAZANFAR


SHAH

SADAQAT NIAZI

WINDOWS FORMS APPLICATION


which is designed to run on a computer
will not run on web browser
platform for Microsoft Windows application
development, based on the .NET Framework
framework provides a clear, object-oriented, extensible
set of classes that enable you to develop rich Windows
applications. Additionally,
act as the local user interface in a multi-tier distributed
solution

DIFFERENCE
WEB BASED APPLICATIONS

WINDOWS FORM APPLICATIONS

The main difference between the Web based


application and Window based application is
that the Web application can be access from
anywhere in the world through the internet

Whereas window based application need to


be install on your machine to access.

IDE: Form1.cs
Integrated Development Environment (IDE)
Form1.cs: code, design and design code

Logic codes
Form
Designer

Designer
codes

IDE: Form1.cs

Contain the logic you put in

How to view this panel?


In solution explorer: Double-click Form1.cs
Menu: View > code OR click on [view code icon]

IDE: Form1.cs

Contain the code representing the form design


Normally, do NOT modify

How to view this panel?


In solution explorer: Double-click on Form1.Designer.cs

IDE: Form1.cs

Contain the form design

How to view this panel?


In solution explorer: Double-click Form1.cs

Toolbar
How to find this window?
Menu: View > Toolbar
If AutoHide is set

Then Toolbar is usually hide on the left


Just hover your mouse over the hidden
Tooblar and reset AutoHide

Toolbar
Toolbar window is Context sensitive
It will show the controls ONLY in the Design View: Eg Form1.cs
[Design]

Toolbar
Categories:
- All Windows Forms
- Common Controls
And others
Use All Windows Forms
to search for unknown
Use Common Controls
for normal usage

Properties Window
How to view Properties Window?
Menu: View > Properties Window

The properties Window usually on the Bottom Right side

Properties Window
Name of Control
Sort by category
Sort from A to Z
Properties
Event
Property page: available
when solution or project
is selected

Properties Window
Properties
Try changing the
Text property from
Form1 to First
WinForm App
Click on Form1 and
type over

Properties Window
Events
Shows all the
events available for
this control
Try add logic for
Form1 Load event by
double-clicking on
Load

Properties Window
Add the following codes into the Form1
Load event:

Build and run the application

Adding Common Controls


Three types of Common Control
Display :
Eg Label
Input :
Eg Textbox, Button
Output: Eg Label

Button with its Click Event


In Form1.cs [Design] view
From the Toolbar, drag a button onto the form OR
double-click on button
Drag the button to the centre of the form

Button with its Click Event


Go to Button Click event code:
Double-click on
Select button1, Click on
event

OR
Icon, then double-clicking on Click

Button with its Click Event


Add the following codes into the button1
Click event:

Build and run the application, then click on


the button

Code Behind
Microsoft invented Code Behind using
Partial Class allows a class to be split into
more than 1 file
Prior to Code Behind- code for logic and
design were placed in the same Class file:
Inline. Code Behind allows logic and
design code to be separated
Partial class Form1
{
:
}

Partial class Form1


{
:
}

Where to output?
For Console Program: using Console.Write() or
Console.WriteLine may still use it for debugging =>
Output window
Two ways to output for Winform Apps
Pop up a message box with the output

Display the output on controls like label, textbox

How to input?
Get inputs from various controls
TextBox: Text property (Eg textBox1.Text)
CheckBox: Checked property (Eg
checkBox1.Checked)
ListBox: SelectedIndex property

Importance
Build Rich, interactive user interfaces:

smart-client component of the .NET Framework.

managed libraries that enable common application tasks Like


Reading
writing to the file system

development environment like Visual Studio helps to create Windows


Forms applications that display
information,
request input from users,
communicate with remote computers over a network.

Build Rich, interactive user interfaces:

a form is a visual surface on which you display information to the


user.

commonly build Windows Forms applications by placing controls on


forms and developing responses to user actions, such as mouse
clicks or key presses.

Acontrolis a discrete user interface (UI) element that displays data


or accepts data input.

Events
When a user does something to your form or
one of its controls
application reacts to these events by using
o

code,

processes the events when they occur.

Build Rich, interactive user interfaces:


Controls

Windows Forms contains a variety of controls that display


o

text boxes,

buttons,

drop-down boxes,

radio buttons,

even Web pages.

Custom UI elements
If one needs to create own custom UI elements, the
System.Drawingnamespace contains all of the classes
one needs to render
o

lines,

circles,

other shapes

directly on a form

ATTENTION PLEASE
NOW WE ARE GOING TO EXPLAIN CODE
AND RUN THE PROGRAM

You might also like