SlideShare a Scribd company logo
1 of 7
Download to read offline
Demo Projects
• Simple Calculator
• Student Progress Report
What will you learn?
• Designing simple user
• Changing properties of controls
• Writing event handler for button
• Using following controls:
o Labels
o Textboxes
o Buttons
o Group-box
Windows Forms for Beginners
Student Progress Report
ser interface
Changing properties of controls
Writing event handler for button’s click event
controls:
Bhushan Mulmule
bhushan.mulmule@gmail.com
www.dotnetvideotutorial.com
Windows Forms for Beginners
Part 1
Bhushan Mulmule
bhushan.mulmule@gmail.com
www.dotnetvideotutorial.com
Windows Forms for Beginners
Project 1: Basic Calculator
• Create New Windows Form Application
• Step 1: Design User Interface
• Step 2: Change Properties of labels, textboxes and buttons
• Step 3: Write Code for buttons
Step 1: Design UI as follow:
Labels
Arrange No1, No2 and
Result labels to align
right walls
Textboxes
User should not able
to type in result
textbox.
In next example to
show output we will
use labels
Buttons
www.dotnetvideotutorial.com
Step 2: Set properties of controls as follow:
Control Name Text Readonly
Form frmBasicCalcii Basic
Calculator
Labels No need to change
Names of labels at left
hand side
Basic
Calculator
Number 1:
Number 2:
Result:
TextBoxes txtNo1
txtNo2
txtResult True
Buttons btnPlus +
btnMinus -
btnMul *
btnDiv /
btnReset Reset
btnExit Exit
Step 3: Add event handlers for buttons
1. Double click on Plus button and code it as follow:
private void btnPlus_Click(object sender, EventArgs e)
{
int no1, no2, result;
no1 = Convert.ToInt32(txtNo1.Text);
no2 = Convert.ToInt32(txtNo2.Text);
result = no1 + no2;
txtResult.Text = result.ToString();
}
Note: Write similar code for minus, multiplication and division.
www.dotnetvideotutorial.com
2. Double click Reset button and write code as follow:
private void btnClear_Click(object sender, EventArgs e)
{
//txtNo1.Text = "";
txtNo1.Clear();
txtNo2.Clear();
txtResult.Clear();
txtNo1.Focus();
}
3. Double click Exit button and write code as follow:
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
4. Application is ready execute and test.
Project 2: Student Progress Report
Step 1: Design UI And Change Properties as shown in callouts
(Please use common sense☺☺☺☺)
• Change Title Label Font size property to make it large
• No need to change Name property of labels at left-hand side as not used in
code
• Change only Text property of labels as shown in image
• Change names for all textboxes as specified in callouts respectively
• Change names for Right hand side output labels for Total, Percentage,
Division and Total.
• Do not change names of left hand side total, percentage, division and total
labels
• To change looks of right hand side output labels change AutoSize: False,
BackColor: White, BorderStyle: FixedSingle, Text: Blank
• Change only Text property of Group-box.
2 Textboxes
Name: txtRollNo,
txtName
5 TextBoxes:
Name: txtEng, txtMar, txtHindi,
txtMaths, txtScience
3 Buttons:
Name: btnOK, btnNew, btnExit
Text: OK, New, Exit
2 Groupbox:
Text: Scores,
Result
11 Labels:
Text: RollNo,
Name,
English,
Marathi,
Hindi, Math,
Science,
Total,
Percentage,
Division,
Result
4 Labels:
To Display output for Total, Percentage,
Division and Result use Labels.
To change looks of these four labels set
following properties:
AutoSize: False
BackColor: White
BorderStyle: FixedSingle
Text: Blank
Name: lblTotal, lblPer, lblDiv, lblResult
www.dotnetvideotutorial.com
Step 3: Add event handlers for buttons
• Double click on OK and code it as follow:
private void btnOK_Click(object sender, EventArgs e)
{
int m1, m2, m3, m4, m5, total;
float per;
string div="", result="";
m1 = Convert.ToInt32(txtEng.Text);
m2 = Convert.ToInt32(txtMar.Text);
m3 = Convert.ToInt32(txtHindi.Text);
m4 = Convert.ToInt32(txtSci.Text);
m5 = Convert.ToInt32(txtMth.Text);
total = m1 + m2 + m3 + m4 + m5;
per = total * 100 / 500.0f;
if (m1 >= 35 && m2 >= 35 && m3 >= 35 && m4 >= 35 && m5
>= 35)
{
result = "PASS";
if (per >= 60)
div = "I";
else if (per >= 45)
div = "II";
else
div = "III";
}
else
{
result = "FAIL";
div = "NA";
}
lblTotal.Text = total.ToString();
lblPer.Text = per.ToString();
lblResult.Text = result;
lblDiv.Text = div;
}
• Double click on New button and code it as follow:
private void btnNew_Click(object sender, EventArgs e)
{
www.dotnetvideotutorial.com
txtRollNo.Text = "";
txtName.Text = "";
txtEng.Text = "";
txtMar.Text = "";
txtHindi.Text = "";
txtMth.Text = "";
txtSci.Text = "";
lblTotal.Text = "";
lblPer.Text = "";
lblResult.Text = "";
lblDiv.Text = "";
txtRollNo.Focus();
}
• Exit button:
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}

More Related Content

What's hot

What's hot (20)

Common dialog control
Common dialog controlCommon dialog control
Common dialog control
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
PYTHON - TKINTER - GUI - PART 1.ppt
PYTHON - TKINTER - GUI - PART 1.pptPYTHON - TKINTER - GUI - PART 1.ppt
PYTHON - TKINTER - GUI - PART 1.ppt
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
VS Code cheat sheet
VS Code cheat sheetVS Code cheat sheet
VS Code cheat sheet
 
Meaning Of VB
Meaning Of VBMeaning Of VB
Meaning Of VB
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
 
Controls events
Controls eventsControls events
Controls events
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
Graphical User Interface in JAVA
Graphical User Interface in JAVAGraphical User Interface in JAVA
Graphical User Interface in JAVA
 
C# basics
 C# basics C# basics
C# basics
 
Visual Basic menu
Visual Basic menuVisual Basic menu
Visual Basic menu
 
Learn Python The Hard Way Presentation
Learn Python The Hard Way PresentationLearn Python The Hard Way Presentation
Learn Python The Hard Way Presentation
 
C sharp
C sharpC sharp
C sharp
 
VB PPT by ADI part-1.pdf
VB PPT by ADI part-1.pdfVB PPT by ADI part-1.pdf
VB PPT by ADI part-1.pdf
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 

Viewers also liked

ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
Anekwong Yoddumnern
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
Gopal Ji Singh
 
Security in E-commerce
Security in E-commerceSecurity in E-commerce
Security in E-commerce
m8817
 

Viewers also liked (15)

Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3
 
Windows Forms For Beginners Part - 2
Windows Forms For Beginners Part - 2Windows Forms For Beginners Part - 2
Windows Forms For Beginners Part - 2
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To Dotnet
 
C++ Windows Forms L02 - Controls P1
C++ Windows Forms L02 - Controls P1C++ Windows Forms L02 - Controls P1
C++ Windows Forms L02 - Controls P1
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
12 gui concepts 1
12 gui concepts 112 gui concepts 1
12 gui concepts 1
 
Csphtp1 12
Csphtp1 12Csphtp1 12
Csphtp1 12
 
Ch2 ar
Ch2 arCh2 ar
Ch2 ar
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 
ASP
ASPASP
ASP
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
E Commerce -Security Threats and Challenges
E Commerce -Security Threats and ChallengesE Commerce -Security Threats and Challenges
E Commerce -Security Threats and Challenges
 
Security in E-commerce
Security in E-commerceSecurity in E-commerce
Security in E-commerce
 

Similar to Windows Forms For Beginners Part - 1

Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
Hock Leng PUAH
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
Tan Ps
 
Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6
helpido9
 
Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6
comp274
 
Gui builder
Gui builderGui builder
Gui builder
learnt
 
Vbtutorial
VbtutorialVbtutorial
Vbtutorial
dhi her
 

Similar to Windows Forms For Beginners Part - 1 (20)

Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptx
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
 
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slidesC# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
 
Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6
 
Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Gui builder
Gui builderGui builder
Gui builder
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
LECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptxLECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptx
 
Creating Windows-based Applications Part-I
Creating Windows-based Applications Part-ICreating Windows-based Applications Part-I
Creating Windows-based Applications Part-I
 
Vs c# lecture1
Vs c# lecture1Vs c# lecture1
Vs c# lecture1
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
 
4.7.14&17.7.14&23.6.15&10.9.15
4.7.14&17.7.14&23.6.15&10.9.154.7.14&17.7.14&23.6.15&10.9.15
4.7.14&17.7.14&23.6.15&10.9.15
 
Vbtutorial
VbtutorialVbtutorial
Vbtutorial
 
Cognos TM1 Assignments
Cognos TM1 Assignments Cognos TM1 Assignments
Cognos TM1 Assignments
 

More from Bhushan Mulmule

More from Bhushan Mulmule (12)

Implementing auto complete using JQuery
Implementing auto complete using JQueryImplementing auto complete using JQuery
Implementing auto complete using JQuery
 
NInject - DI Container
NInject - DI ContainerNInject - DI Container
NInject - DI Container
 
Dependency injection for beginners
Dependency injection for beginnersDependency injection for beginners
Dependency injection for beginners
 
Understanding Interfaces
Understanding InterfacesUnderstanding Interfaces
Understanding Interfaces
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Inheritance
InheritanceInheritance
Inheritance
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Methods
MethodsMethods
Methods
 
Arrays, Structures And Enums
Arrays, Structures And EnumsArrays, Structures And Enums
Arrays, Structures And Enums
 
Flow Control (C#)
Flow Control (C#)Flow Control (C#)
Flow Control (C#)
 
Getting started with C# Programming
Getting started with C# ProgrammingGetting started with C# Programming
Getting started with C# Programming
 
Overview of .Net Framework 4.5
Overview of .Net Framework 4.5Overview of .Net Framework 4.5
Overview of .Net Framework 4.5
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Windows Forms For Beginners Part - 1

  • 1. Demo Projects • Simple Calculator • Student Progress Report What will you learn? • Designing simple user • Changing properties of controls • Writing event handler for button • Using following controls: o Labels o Textboxes o Buttons o Group-box Windows Forms for Beginners Student Progress Report ser interface Changing properties of controls Writing event handler for button’s click event controls: Bhushan Mulmule bhushan.mulmule@gmail.com www.dotnetvideotutorial.com Windows Forms for Beginners Part 1 Bhushan Mulmule bhushan.mulmule@gmail.com www.dotnetvideotutorial.com Windows Forms for Beginners
  • 2. Project 1: Basic Calculator • Create New Windows Form Application • Step 1: Design User Interface • Step 2: Change Properties of labels, textboxes and buttons • Step 3: Write Code for buttons Step 1: Design UI as follow: Labels Arrange No1, No2 and Result labels to align right walls Textboxes User should not able to type in result textbox. In next example to show output we will use labels Buttons
  • 3. www.dotnetvideotutorial.com Step 2: Set properties of controls as follow: Control Name Text Readonly Form frmBasicCalcii Basic Calculator Labels No need to change Names of labels at left hand side Basic Calculator Number 1: Number 2: Result: TextBoxes txtNo1 txtNo2 txtResult True Buttons btnPlus + btnMinus - btnMul * btnDiv / btnReset Reset btnExit Exit Step 3: Add event handlers for buttons 1. Double click on Plus button and code it as follow: private void btnPlus_Click(object sender, EventArgs e) { int no1, no2, result; no1 = Convert.ToInt32(txtNo1.Text); no2 = Convert.ToInt32(txtNo2.Text); result = no1 + no2; txtResult.Text = result.ToString(); } Note: Write similar code for minus, multiplication and division.
  • 4. www.dotnetvideotutorial.com 2. Double click Reset button and write code as follow: private void btnClear_Click(object sender, EventArgs e) { //txtNo1.Text = ""; txtNo1.Clear(); txtNo2.Clear(); txtResult.Clear(); txtNo1.Focus(); } 3. Double click Exit button and write code as follow: private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } 4. Application is ready execute and test. Project 2: Student Progress Report Step 1: Design UI And Change Properties as shown in callouts (Please use common sense☺☺☺☺) • Change Title Label Font size property to make it large • No need to change Name property of labels at left-hand side as not used in code • Change only Text property of labels as shown in image • Change names for all textboxes as specified in callouts respectively • Change names for Right hand side output labels for Total, Percentage, Division and Total. • Do not change names of left hand side total, percentage, division and total labels • To change looks of right hand side output labels change AutoSize: False, BackColor: White, BorderStyle: FixedSingle, Text: Blank • Change only Text property of Group-box.
  • 5. 2 Textboxes Name: txtRollNo, txtName 5 TextBoxes: Name: txtEng, txtMar, txtHindi, txtMaths, txtScience 3 Buttons: Name: btnOK, btnNew, btnExit Text: OK, New, Exit 2 Groupbox: Text: Scores, Result 11 Labels: Text: RollNo, Name, English, Marathi, Hindi, Math, Science, Total, Percentage, Division, Result 4 Labels: To Display output for Total, Percentage, Division and Result use Labels. To change looks of these four labels set following properties: AutoSize: False BackColor: White BorderStyle: FixedSingle Text: Blank Name: lblTotal, lblPer, lblDiv, lblResult
  • 6. www.dotnetvideotutorial.com Step 3: Add event handlers for buttons • Double click on OK and code it as follow: private void btnOK_Click(object sender, EventArgs e) { int m1, m2, m3, m4, m5, total; float per; string div="", result=""; m1 = Convert.ToInt32(txtEng.Text); m2 = Convert.ToInt32(txtMar.Text); m3 = Convert.ToInt32(txtHindi.Text); m4 = Convert.ToInt32(txtSci.Text); m5 = Convert.ToInt32(txtMth.Text); total = m1 + m2 + m3 + m4 + m5; per = total * 100 / 500.0f; if (m1 >= 35 && m2 >= 35 && m3 >= 35 && m4 >= 35 && m5 >= 35) { result = "PASS"; if (per >= 60) div = "I"; else if (per >= 45) div = "II"; else div = "III"; } else { result = "FAIL"; div = "NA"; } lblTotal.Text = total.ToString(); lblPer.Text = per.ToString(); lblResult.Text = result; lblDiv.Text = div; } • Double click on New button and code it as follow: private void btnNew_Click(object sender, EventArgs e) {
  • 7. www.dotnetvideotutorial.com txtRollNo.Text = ""; txtName.Text = ""; txtEng.Text = ""; txtMar.Text = ""; txtHindi.Text = ""; txtMth.Text = ""; txtSci.Text = ""; lblTotal.Text = ""; lblPer.Text = ""; lblResult.Text = ""; lblDiv.Text = ""; txtRollNo.Focus(); } • Exit button: private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); }