SlideShare ist ein Scribd-Unternehmen logo
1 von 3
How do I Create a project named DayNight. Include a Form that contains two Buttons, one
labeled Day and one labeled Night. Add a Label telling the user to click a button. When the user
clicks Day, change the BackColor of the Form to Yellow; when the user clicks Night, change the
BackColor of the Form to DarkBlue in C#?
Solution
Good Wishes,
First let me give the code:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DayNight
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
/*Button button1=new Buton();
Button button2=new Buton();*/
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "Please click on a button to see the background color change";
button1.Text = "Day";
button2.Text = "Night";
}
private void button1_Click(object sender, EventArgs e)
{
this.BackColor = System.Drawing.Color.Yellow;
}
private void button2_Click(object sender, EventArgs e)
{
this.BackColor = System.Drawing.Color.DarkBlue;
}
}
}
Explaination:
Initially i created a project named DayNight
namespace DayNight
{}
Then I created a form
public partial class Form1 : Form
Then I created a constructor
public Form1()
{
InitializeComponent();
/*Button button1=new Buton();
Button button2=new Buton();*/
}
Then i wrote a function to load the form
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "Please click on a button to see the background color change";
button1.Text = "Day";
button2.Text = "Night";
}
In this function I created a label to indicate the user to click on a button
label1.Text = "Please click on a button to see the background color change";
Next I labelled the two buttons as one "Day" and the other "Night"
button1.Text = "Day";
button2.Text = "Night";
Then I created a fuction to handle the button1 on click event
private void button1_Click(object sender, EventArgs e)
{
this.BackColor = System.Drawing.Color.Yellow;
}
here when button1 is clicked the background color of the form changes to Yelow in color.
Then I created a fuction to handle the button2 on click event
private void button2_Click(object sender, EventArgs e)
{
this.BackColor = System.Drawing.Color.Dark Blue;
}
here when button2 is clicked the background color of the form changes to Dark Blue in color.
Hope this is clear.

Weitere ähnliche Inhalte

Ähnlich wie How do I Create a project named DayNight- Include a Form that contains.docx

simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8srividhyasowrirajan
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2Kobkrit Viriyayudhakorn
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Bhushan Mulmule
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsNick Pruehs
 
YOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdf
YOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdfYOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdf
YOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdfrajkumarm401
 
Hack2the future Microsoft .NET Gadgeteer
Hack2the future Microsoft .NET GadgeteerHack2the future Microsoft .NET Gadgeteer
Hack2the future Microsoft .NET GadgeteerLee Stott
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Bhushan Mulmule
 
Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2kshyju
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Bhushan Mulmule
 
Lighting with Photoshop
Lighting with PhotoshopLighting with Photoshop
Lighting with PhotoshopNYCCTfab
 
Practical ActivitiesWeek06lab08-1.pngPractical Activities.docx
Practical ActivitiesWeek06lab08-1.pngPractical Activities.docxPractical ActivitiesWeek06lab08-1.pngPractical Activities.docx
Practical ActivitiesWeek06lab08-1.pngPractical Activities.docxChantellPantoja184
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY GOKUL SREE
 

Ähnlich wie How do I Create a project named DayNight- Include a Form that contains.docx (17)

Introduction
IntroductionIntroduction
Introduction
 
simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
 
Swing
SwingSwing
Swing
 
Colin dockerty task2 workflow
Colin dockerty task2 workflowColin dockerty task2 workflow
Colin dockerty task2 workflow
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
YOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdf
YOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdfYOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdf
YOU DO IT 4! create an named YouDolt 4 and save it in the vB 2015Chap.pdf
 
Hack2the future Microsoft .NET Gadgeteer
Hack2the future Microsoft .NET GadgeteerHack2the future Microsoft .NET Gadgeteer
Hack2the future Microsoft .NET Gadgeteer
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
 
Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
Lighting with Photoshop
Lighting with PhotoshopLighting with Photoshop
Lighting with Photoshop
 
Spf chapter10 events
Spf chapter10 eventsSpf chapter10 events
Spf chapter10 events
 
Practical ActivitiesWeek06lab08-1.pngPractical Activities.docx
Practical ActivitiesWeek06lab08-1.pngPractical Activities.docxPractical ActivitiesWeek06lab08-1.pngPractical Activities.docx
Practical ActivitiesWeek06lab08-1.pngPractical Activities.docx
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 

Mehr von hamblymarta

Choose a piece of children's-adolescent media from any era and analyze.docx
Choose a piece of children's-adolescent media from any era and analyze.docxChoose a piece of children's-adolescent media from any era and analyze.docx
Choose a piece of children's-adolescent media from any era and analyze.docxhamblymarta
 
Complete parts (a) and (b) below- The number of dogs per household in.docx
Complete parts (a) and (b) below- The number of dogs per household in.docxComplete parts (a) and (b) below- The number of dogs per household in.docx
Complete parts (a) and (b) below- The number of dogs per household in.docxhamblymarta
 
Comider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docx
Comider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docxComider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docx
Comider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docxhamblymarta
 
Combining estimates with projections of likely events such as turnover.docx
Combining estimates with projections of likely events such as turnover.docxCombining estimates with projections of likely events such as turnover.docx
Combining estimates with projections of likely events such as turnover.docxhamblymarta
 
Christine Danes has asked Dave and Mike to help her move into a new ap.docx
Christine Danes has asked Dave and Mike to help her move into a new ap.docxChristine Danes has asked Dave and Mike to help her move into a new ap.docx
Christine Danes has asked Dave and Mike to help her move into a new ap.docxhamblymarta
 
Cody is trying to explain to Sarah that one advantage enjoyed by plant.docx
Cody is trying to explain to Sarah that one advantage enjoyed by plant.docxCody is trying to explain to Sarah that one advantage enjoyed by plant.docx
Cody is trying to explain to Sarah that one advantage enjoyed by plant.docxhamblymarta
 
Combining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docx
Combining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docxCombining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docx
Combining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docxhamblymarta
 
Code needed in C++ Input and formatted output- Right-facing arrow Give.docx
Code needed in C++ Input and formatted output- Right-facing arrow Give.docxCode needed in C++ Input and formatted output- Right-facing arrow Give.docx
Code needed in C++ Input and formatted output- Right-facing arrow Give.docxhamblymarta
 
Class problem 5 -Animal personality- has been defined as consistent di.docx
Class problem 5 -Animal personality- has been defined as consistent di.docxClass problem 5 -Animal personality- has been defined as consistent di.docx
Class problem 5 -Animal personality- has been defined as consistent di.docxhamblymarta
 
Class Discussion - Guest Speaker - Laura Sonderup Q1- From your exper.docx
Class Discussion - Guest Speaker - Laura Sonderup Q1-  From your exper.docxClass Discussion - Guest Speaker - Laura Sonderup Q1-  From your exper.docx
Class Discussion - Guest Speaker - Laura Sonderup Q1- From your exper.docxhamblymarta
 
Choose all that apply- Which of the following proteins would have an E.docx
Choose all that apply- Which of the following proteins would have an E.docxChoose all that apply- Which of the following proteins would have an E.docx
Choose all that apply- Which of the following proteins would have an E.docxhamblymarta
 
Choose all that apply- Which of the following is something that all ce.docx
Choose all that apply- Which of the following is something that all ce.docxChoose all that apply- Which of the following is something that all ce.docx
Choose all that apply- Which of the following is something that all ce.docxhamblymarta
 
Choose every statement that is true about the cytoplasm- Cytoplasm can.docx
Choose every statement that is true about the cytoplasm- Cytoplasm can.docxChoose every statement that is true about the cytoplasm- Cytoplasm can.docx
Choose every statement that is true about the cytoplasm- Cytoplasm can.docxhamblymarta
 
Case Study- Data-Driven Transformation of Springfield's Police Force S.docx
Case Study- Data-Driven Transformation of Springfield's Police Force S.docxCase Study- Data-Driven Transformation of Springfield's Police Force S.docx
Case Study- Data-Driven Transformation of Springfield's Police Force S.docxhamblymarta
 
Charles Darwin used many different aspects of the natural world as evi.docx
Charles Darwin used many different aspects of the natural world as evi.docxCharles Darwin used many different aspects of the natural world as evi.docx
Charles Darwin used many different aspects of the natural world as evi.docxhamblymarta
 
Chapter 2 notes various problems in the use of ratios and metrics- Whi.docx
Chapter 2 notes various problems in the use of ratios and metrics- Whi.docxChapter 2 notes various problems in the use of ratios and metrics- Whi.docx
Chapter 2 notes various problems in the use of ratios and metrics- Whi.docxhamblymarta
 
Case -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docx
Case -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docxCase -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docx
Case -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docxhamblymarta
 
care plannursing diagnose risk for evidenced by prostatis nursing dia.docx
care plannursing diagnose risk for evidenced by prostatis  nursing dia.docxcare plannursing diagnose risk for evidenced by prostatis  nursing dia.docx
care plannursing diagnose risk for evidenced by prostatis nursing dia.docxhamblymarta
 
Can you please help me answer these two multiple choice questions- Tha.docx
Can you please help me answer these two multiple choice questions- Tha.docxCan you please help me answer these two multiple choice questions- Tha.docx
Can you please help me answer these two multiple choice questions- Tha.docxhamblymarta
 
can someome please write the init method please This interface defines.docx
can someome please write the init method please This interface defines.docxcan someome please write the init method please This interface defines.docx
can someome please write the init method please This interface defines.docxhamblymarta
 

Mehr von hamblymarta (20)

Choose a piece of children's-adolescent media from any era and analyze.docx
Choose a piece of children's-adolescent media from any era and analyze.docxChoose a piece of children's-adolescent media from any era and analyze.docx
Choose a piece of children's-adolescent media from any era and analyze.docx
 
Complete parts (a) and (b) below- The number of dogs per household in.docx
Complete parts (a) and (b) below- The number of dogs per household in.docxComplete parts (a) and (b) below- The number of dogs per household in.docx
Complete parts (a) and (b) below- The number of dogs per household in.docx
 
Comider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docx
Comider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docxComider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docx
Comider a pond or tiver adfacent to a higpo iawn in Arrica- The water.docx
 
Combining estimates with projections of likely events such as turnover.docx
Combining estimates with projections of likely events such as turnover.docxCombining estimates with projections of likely events such as turnover.docx
Combining estimates with projections of likely events such as turnover.docx
 
Christine Danes has asked Dave and Mike to help her move into a new ap.docx
Christine Danes has asked Dave and Mike to help her move into a new ap.docxChristine Danes has asked Dave and Mike to help her move into a new ap.docx
Christine Danes has asked Dave and Mike to help her move into a new ap.docx
 
Cody is trying to explain to Sarah that one advantage enjoyed by plant.docx
Cody is trying to explain to Sarah that one advantage enjoyed by plant.docxCody is trying to explain to Sarah that one advantage enjoyed by plant.docx
Cody is trying to explain to Sarah that one advantage enjoyed by plant.docx
 
Combining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docx
Combining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docxCombining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docx
Combining Prehension and Propulsion- The Foot of Ardipithecus ramidus.docx
 
Code needed in C++ Input and formatted output- Right-facing arrow Give.docx
Code needed in C++ Input and formatted output- Right-facing arrow Give.docxCode needed in C++ Input and formatted output- Right-facing arrow Give.docx
Code needed in C++ Input and formatted output- Right-facing arrow Give.docx
 
Class problem 5 -Animal personality- has been defined as consistent di.docx
Class problem 5 -Animal personality- has been defined as consistent di.docxClass problem 5 -Animal personality- has been defined as consistent di.docx
Class problem 5 -Animal personality- has been defined as consistent di.docx
 
Class Discussion - Guest Speaker - Laura Sonderup Q1- From your exper.docx
Class Discussion - Guest Speaker - Laura Sonderup Q1-  From your exper.docxClass Discussion - Guest Speaker - Laura Sonderup Q1-  From your exper.docx
Class Discussion - Guest Speaker - Laura Sonderup Q1- From your exper.docx
 
Choose all that apply- Which of the following proteins would have an E.docx
Choose all that apply- Which of the following proteins would have an E.docxChoose all that apply- Which of the following proteins would have an E.docx
Choose all that apply- Which of the following proteins would have an E.docx
 
Choose all that apply- Which of the following is something that all ce.docx
Choose all that apply- Which of the following is something that all ce.docxChoose all that apply- Which of the following is something that all ce.docx
Choose all that apply- Which of the following is something that all ce.docx
 
Choose every statement that is true about the cytoplasm- Cytoplasm can.docx
Choose every statement that is true about the cytoplasm- Cytoplasm can.docxChoose every statement that is true about the cytoplasm- Cytoplasm can.docx
Choose every statement that is true about the cytoplasm- Cytoplasm can.docx
 
Case Study- Data-Driven Transformation of Springfield's Police Force S.docx
Case Study- Data-Driven Transformation of Springfield's Police Force S.docxCase Study- Data-Driven Transformation of Springfield's Police Force S.docx
Case Study- Data-Driven Transformation of Springfield's Police Force S.docx
 
Charles Darwin used many different aspects of the natural world as evi.docx
Charles Darwin used many different aspects of the natural world as evi.docxCharles Darwin used many different aspects of the natural world as evi.docx
Charles Darwin used many different aspects of the natural world as evi.docx
 
Chapter 2 notes various problems in the use of ratios and metrics- Whi.docx
Chapter 2 notes various problems in the use of ratios and metrics- Whi.docxChapter 2 notes various problems in the use of ratios and metrics- Whi.docx
Chapter 2 notes various problems in the use of ratios and metrics- Whi.docx
 
Case -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docx
Case -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docxCase -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docx
Case -#2- Royal Bank of Canada v- Head West Energy Inc-- 2007 ABQB 154.docx
 
care plannursing diagnose risk for evidenced by prostatis nursing dia.docx
care plannursing diagnose risk for evidenced by prostatis  nursing dia.docxcare plannursing diagnose risk for evidenced by prostatis  nursing dia.docx
care plannursing diagnose risk for evidenced by prostatis nursing dia.docx
 
Can you please help me answer these two multiple choice questions- Tha.docx
Can you please help me answer these two multiple choice questions- Tha.docxCan you please help me answer these two multiple choice questions- Tha.docx
Can you please help me answer these two multiple choice questions- Tha.docx
 
can someome please write the init method please This interface defines.docx
can someome please write the init method please This interface defines.docxcan someome please write the init method please This interface defines.docx
can someome please write the init method please This interface defines.docx
 

Kürzlich hochgeladen

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Kürzlich hochgeladen (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

How do I Create a project named DayNight- Include a Form that contains.docx

  • 1. How do I Create a project named DayNight. Include a Form that contains two Buttons, one labeled Day and one labeled Night. Add a Label telling the user to click a button. When the user clicks Day, change the BackColor of the Form to Yellow; when the user clicks Night, change the BackColor of the Form to DarkBlue in C#? Solution Good Wishes, First let me give the code: using System; using System.Drawing; using System.Windows.Forms; namespace DayNight { public partial class Form1 : Form { public Form1() { InitializeComponent(); /*Button button1=new Buton(); Button button2=new Buton();*/ } private void Form1_Load(object sender, EventArgs e) { label1.Text = "Please click on a button to see the background color change"; button1.Text = "Day"; button2.Text = "Night"; } private void button1_Click(object sender, EventArgs e) { this.BackColor = System.Drawing.Color.Yellow;
  • 2. } private void button2_Click(object sender, EventArgs e) { this.BackColor = System.Drawing.Color.DarkBlue; } } } Explaination: Initially i created a project named DayNight namespace DayNight {} Then I created a form public partial class Form1 : Form Then I created a constructor public Form1() { InitializeComponent(); /*Button button1=new Buton(); Button button2=new Buton();*/ } Then i wrote a function to load the form private void Form1_Load(object sender, EventArgs e) { label1.Text = "Please click on a button to see the background color change"; button1.Text = "Day"; button2.Text = "Night"; } In this function I created a label to indicate the user to click on a button label1.Text = "Please click on a button to see the background color change"; Next I labelled the two buttons as one "Day" and the other "Night" button1.Text = "Day"; button2.Text = "Night";
  • 3. Then I created a fuction to handle the button1 on click event private void button1_Click(object sender, EventArgs e) { this.BackColor = System.Drawing.Color.Yellow; } here when button1 is clicked the background color of the form changes to Yelow in color. Then I created a fuction to handle the button2 on click event private void button2_Click(object sender, EventArgs e) { this.BackColor = System.Drawing.Color.Dark Blue; } here when button2 is clicked the background color of the form changes to Dark Blue in color. Hope this is clear.