SlideShare a Scribd company logo
1 of 24
Programming
Data Type
Int
String
Boolian
Double
Float
Conditions
If statements
Switch case
Looping
For loop
While
Do while
Nested loop
Creating a new Visual
Studio C# Project
• Once Visual Studio is running the
first step is to create a new
project. This will cause the New
Project window to appear
containing a range of different
types of project. Chose Windows
Forms Application
• At the bottom of the window is a
field for providing a project name.
press the OK button to initiate the
creation of the new project.
• Once the new project has been
created the main Visual Studio
window will appear. At the center
of this window will be a new form
in which we will create the user
interface for our sample C#
application.
Toolbox
Form
Controls properties
• Every Windows Forms program will use the Form.
• The Form is the most fundamental object used in an
application. By itself, a form does nothing. Its main role is to
host other objects that the user uses to interact with the
computer.
Adding Controls
In the design view, you use the mouse to drag controls, which are components
with visual representation such as buttons and text boxes, onto a design surface.
The following illustration shows a combo box that has been dragged from
the Toolbox window onto a form in the Windows Forms Designer.
no Property Name Description
1 BackColor Change the background color for the control.
2 Background mage Change the background image displayed in the control.
3 BackgroundImageLayout Change the background image layout .
4 ControlBox Change a value indicating whether a control box is displayed in the caption
bar of the form.
5 Cursor Change the cursor that is displayed when the mouse pointer is over the
control.
6 Font Change the font of the text displayed by the control.
7 ForeColor Change the foreground (font) color of the control. (font)
8 MaximizeBox Change a value indicating whether the Maximize button is displayed in the
caption bar of the form.
9 MinimizeBox Change a value indicating whether the Minimize button is displayed in the
caption bar of the form.
10 Name Change the name of the control.
11 RightToLeft Change a value indicating whether control's elements are aligned to
support locales using right-to-left fonts
12 RightToLeftLayout Change a value indicating whether right-to-left mirror placement is turned
on.
13 StartPosition Change the starting position of the form at run time.
14 Text Change the text associated with this control
15 WindowState Change a value that indicates whether form is minimized, maximized, or
normal.
After you add a control
to the design surface,
you can use
the Properties window
to set its properties,
such as background
color and default text.
• A button accepts clicks. In Windows Forms
we use a Button control that accepts click
events and performs other actions in the
user interface.
no Property Name Description
1 BackColor Change the background color for the control.
2 Background image Change the background image displayed in the control.
3 BackgroundImageLayout Change the background image layout .
4 Cursor Change the cursor that is displayed when the mouse pointer is over the
control.
5 Font Change the font of the text displayed by the control.
6 ForeColor Change the foreground (font) color of the control. (font)
7 Name Change the name of the control.
8 RightToLeft Change a value indicating whether control's elements are aligned to
support locales using right-to-left fonts
9 Text Change the text associated with this control
In this project
• Changing the backcolor of the form (form properties)
• Drag down two buttons from common controls
• hello button (by clicking in button it shows a messagebox (“hello”))
• exit button (by clicking in button the application will be closed)
• Changing the backcolor , forecolor and font of button (from properties)
Code
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("hello ");
}
• Click on Exit button
then the
application will be
closed
• lets users type letters and enter data.
Property Name Description
BackColor Gets or sets the background color of the control.
Font Gets or sets the font of the text displayed by the control.
ForeColor Gets or sets the foreground color of the control.
MaxLength Gets or sets the maximum number of characters the user can type or
paste into the text box control.
Multiline Gets or sets a value indicating whether this is a multiline TextBox
control.
Name Gets or sets the name of the control.
PasswordChar Gets or sets the character used to mask characters of a password in a
single-line TextBox control.
Text Gets or sets the current text in the TextBox.
In this project
• Drag down a Textbox
• Drag down three buttons from common controls
• hello button (by clicking in this button it shows a messagebox (“hello”))
• exit button (by clicking in this button the application will be closed)
• Hi button (by clicking in this button it will show “hi” in the textbox
• Changing the backcolor , forecolor and font of button (from properties)
• Changing the backcolor , forecolor and font of Textbox(from properties)
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("hello");
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = "hi";
}
• The most important characteristic
of a label control is the text it
displays.
• That text is also referred to as its
caption and this is what the user
would read.
• Important property is AutoSize.
In this project
• Drag down a three Textbox
• Drag down a three Labels
• Drag down four buttons from common controls
• + button (by clicking in this button textbox3 will show the result of A+B
• - button (by clicking in this button textbox3 will show the result of A-B
• / button (by clicking in this button textbox3 will show the result of A/B
• * button (by clicking in this button textbox3 will show the result of A*B
• Changing the backcolor , forecolor and font of button (from properties)
• Changing the backcolor , forecolor and font of Textbox(from properties)
• Changing the backcolor , forecolor and font of Labels(from properties)
int a, b, c;
private void button3_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a / b;
textBox3.Text = Convert.ToString(c);
}
private void button4_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a * b;
textBox3.Text = Convert.ToString(c);
}
private void button2_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a - b;
textBox3.Text = Convert.ToString(c);
}
private void button1_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a + b;
textBox3.Text = Convert.ToString(c);
}
• PictureBox provides a rectangular region for an image.
• It supports many image formats.
• Allows you to include images on your form.
• Important Properties:
• Image (Browse to file)
• Location
• SizeMode
• Normal, StretchImage, AutoSize, CenterImage, Zoom
• BorderStyle
Example
presents an interface for date selection. It allows the
user to select a valid DateTime without much effort
on your part.
In this project
• Drag down a button (by clicking in the button a message will
show the date )
• Drag down a dateTimePicker (by double click in the
dateTimePicker you can change the date (year, month and day)
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(dateTimePicker1.Text);
}
private void Form1_Load(object sender, EventArgs e)
{
dateTimePicker1.CustomFormat = "ddd,dd-MM-yy";
dateTimePicker1.Format = DateTimePickerFormat.Custom;
}
Any format
Example
dd,mm,yy
ddd-mmm-yyy
Vs c# lecture1

More Related Content

What's hot

Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
Hock Leng PUAH
 
Image contro, and format functions in vb
Image contro, and format functions in vbImage contro, and format functions in vb
Image contro, and format functions in vb
Amandeep Kaur
 
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
 
Session 1. Bai 1 ve winform
Session 1. Bai 1 ve winformSession 1. Bai 1 ve winform
Session 1. Bai 1 ve winform
mrtom16071980
 

What's hot (19)

Vs c# lecture2
Vs c# lecture2Vs c# lecture2
Vs c# lecture2
 
Vs c# lecture8
Vs c# lecture8Vs c# lecture8
Vs c# lecture8
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
06 win forms
06 win forms06 win forms
06 win forms
 
Vp lecture 6 ararat
Vp lecture 6 araratVp lecture 6 ararat
Vp lecture 6 ararat
 
Spf chapter10 events
Spf chapter10 eventsSpf chapter10 events
Spf chapter10 events
 
Nokia Asha App Development - Part 2
Nokia Asha App Development - Part 2Nokia Asha App Development - Part 2
Nokia Asha App Development - Part 2
 
100 keyboard shortcuts for windows 8
100 keyboard shortcuts for windows 8100 keyboard shortcuts for windows 8
100 keyboard shortcuts for windows 8
 
Image contro, and format functions in vb
Image contro, and format functions in vbImage contro, and format functions in vb
Image contro, and format functions in vb
 
Controls events
Controls eventsControls events
Controls events
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
General window shortcuts
General window shortcutsGeneral window shortcuts
General window shortcuts
 
All list of keyboard shortcuts for windows 7
All list of keyboard shortcuts for windows 7All list of keyboard shortcuts for windows 7
All list of keyboard shortcuts for windows 7
 
2 front panel
2  front panel2  front panel
2 front panel
 
Session 1. Bai 1 ve winform
Session 1. Bai 1 ve winformSession 1. Bai 1 ve winform
Session 1. Bai 1 ve winform
 
Shortcut key for windows
Shortcut key for windowsShortcut key for windows
Shortcut key for windows
 
Keyboard shortcuts for Windows
Keyboard shortcuts for WindowsKeyboard shortcuts for Windows
Keyboard shortcuts for Windows
 
Maliram poonia project
Maliram poonia projectMaliram poonia project
Maliram poonia project
 
Introduction to Visual Basic
Introduction to Visual Basic Introduction to Visual Basic
Introduction to Visual Basic
 

Similar to Vs c# lecture1

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
 
Create formsexcel
Create formsexcelCreate formsexcel
Create formsexcel
Ravi Gajul
 

Similar to Vs c# lecture1 (20)

Vp lecture1 ararat
Vp lecture1 araratVp lecture1 ararat
Vp lecture1 ararat
 
Vp lecture 2 ararat
Vp lecture 2 araratVp lecture 2 ararat
Vp lecture 2 ararat
 
Chapter 02
Chapter 02Chapter 02
Chapter 02
 
Buttons In .net Visual Basic
Buttons In .net Visual BasicButtons In .net Visual Basic
Buttons In .net Visual Basic
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
 
Unit2
Unit2Unit2
Unit2
 
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
 
VB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdfVB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdf
 
VB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdfVB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdf
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
VB PROPERTIES.pptx
VB PROPERTIES.pptxVB PROPERTIES.pptx
VB PROPERTIES.pptx
 
Create formsexcel
Create formsexcelCreate formsexcel
Create formsexcel
 
Visual basic
Visual basicVisual basic
Visual basic
 
Visual Basic.pptx
Visual Basic.pptxVisual Basic.pptx
Visual Basic.pptx
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
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
 
GUI -THESIS123
GUI -THESIS123GUI -THESIS123
GUI -THESIS123
 
Vb
VbVb
Vb
 
Mobile Application Development class 007
Mobile Application Development class 007Mobile Application Development class 007
Mobile Application Development class 007
 
CheckBox In C#.pptx
CheckBox In C#.pptxCheckBox In C#.pptx
CheckBox In C#.pptx
 

More from Saman M. Almufti

More from Saman M. Almufti (20)

Lecture 7- domain name
Lecture  7- domain nameLecture  7- domain name
Lecture 7- domain name
 
Vp lecture 11 ararat
Vp lecture 11 araratVp lecture 11 ararat
Vp lecture 11 ararat
 
Vp lecture 10 ararat
Vp lecture 10 araratVp lecture 10 ararat
Vp lecture 10 ararat
 
Vp lecture 12 ararat
Vp lecture 12 araratVp lecture 12 ararat
Vp lecture 12 ararat
 
Vp lecture 9 ararat
Vp lecture 9 araratVp lecture 9 ararat
Vp lecture 9 ararat
 
Lecture 6- http
Lecture  6- httpLecture  6- http
Lecture 6- http
 
Lecture 5- url-dns
Lecture  5- url-dnsLecture  5- url-dns
Lecture 5- url-dns
 
Vp lecture 7 ararat
Vp lecture 7 araratVp lecture 7 ararat
Vp lecture 7 ararat
 
Lecture 4- ip
Lecture  4- ipLecture  4- ip
Lecture 4- ip
 
Vp lecture 5 ararat
Vp lecture 5 araratVp lecture 5 ararat
Vp lecture 5 ararat
 
Lecture 3- tcp-ip
Lecture  3- tcp-ipLecture  3- tcp-ip
Lecture 3- tcp-ip
 
Vp lecture 4 ararat
Vp lecture 4 araratVp lecture 4 ararat
Vp lecture 4 ararat
 
Vp lecture 3 ararat
Vp lecture 3 araratVp lecture 3 ararat
Vp lecture 3 ararat
 
Lecture 2- terminology
Lecture  2- terminologyLecture  2- terminology
Lecture 2- terminology
 
Lecture 1- introduction
Lecture  1- introductionLecture  1- introduction
Lecture 1- introduction
 
Vs c# lecture12
Vs c# lecture12Vs c# lecture12
Vs c# lecture12
 
Vs c# lecture11
Vs c# lecture11Vs c# lecture11
Vs c# lecture11
 
Vs c# lecture10
Vs c# lecture10Vs c# lecture10
Vs c# lecture10
 
Vs c# lecture9
Vs c# lecture9Vs c# lecture9
Vs c# lecture9
 
Vs c# lecture7
Vs c# lecture7Vs c# lecture7
Vs c# lecture7
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Vs c# lecture1

  • 1.
  • 2.
  • 4. Creating a new Visual Studio C# Project • Once Visual Studio is running the first step is to create a new project. This will cause the New Project window to appear containing a range of different types of project. Chose Windows Forms Application • At the bottom of the window is a field for providing a project name. press the OK button to initiate the creation of the new project. • Once the new project has been created the main Visual Studio window will appear. At the center of this window will be a new form in which we will create the user interface for our sample C# application.
  • 6. • Every Windows Forms program will use the Form. • The Form is the most fundamental object used in an application. By itself, a form does nothing. Its main role is to host other objects that the user uses to interact with the computer.
  • 7. Adding Controls In the design view, you use the mouse to drag controls, which are components with visual representation such as buttons and text boxes, onto a design surface. The following illustration shows a combo box that has been dragged from the Toolbox window onto a form in the Windows Forms Designer.
  • 8. no Property Name Description 1 BackColor Change the background color for the control. 2 Background mage Change the background image displayed in the control. 3 BackgroundImageLayout Change the background image layout . 4 ControlBox Change a value indicating whether a control box is displayed in the caption bar of the form. 5 Cursor Change the cursor that is displayed when the mouse pointer is over the control. 6 Font Change the font of the text displayed by the control. 7 ForeColor Change the foreground (font) color of the control. (font) 8 MaximizeBox Change a value indicating whether the Maximize button is displayed in the caption bar of the form. 9 MinimizeBox Change a value indicating whether the Minimize button is displayed in the caption bar of the form. 10 Name Change the name of the control. 11 RightToLeft Change a value indicating whether control's elements are aligned to support locales using right-to-left fonts 12 RightToLeftLayout Change a value indicating whether right-to-left mirror placement is turned on. 13 StartPosition Change the starting position of the form at run time. 14 Text Change the text associated with this control 15 WindowState Change a value that indicates whether form is minimized, maximized, or normal. After you add a control to the design surface, you can use the Properties window to set its properties, such as background color and default text.
  • 9. • A button accepts clicks. In Windows Forms we use a Button control that accepts click events and performs other actions in the user interface.
  • 10. no Property Name Description 1 BackColor Change the background color for the control. 2 Background image Change the background image displayed in the control. 3 BackgroundImageLayout Change the background image layout . 4 Cursor Change the cursor that is displayed when the mouse pointer is over the control. 5 Font Change the font of the text displayed by the control. 6 ForeColor Change the foreground (font) color of the control. (font) 7 Name Change the name of the control. 8 RightToLeft Change a value indicating whether control's elements are aligned to support locales using right-to-left fonts 9 Text Change the text associated with this control
  • 11. In this project • Changing the backcolor of the form (form properties) • Drag down two buttons from common controls • hello button (by clicking in button it shows a messagebox (“hello”)) • exit button (by clicking in button the application will be closed) • Changing the backcolor , forecolor and font of button (from properties) Code private void button1_Click(object sender, EventArgs e) { Application.Exit(); } private void button2_Click(object sender, EventArgs e) { MessageBox.Show("hello "); } • Click on Exit button then the application will be closed
  • 12. • lets users type letters and enter data. Property Name Description BackColor Gets or sets the background color of the control. Font Gets or sets the font of the text displayed by the control. ForeColor Gets or sets the foreground color of the control. MaxLength Gets or sets the maximum number of characters the user can type or paste into the text box control. Multiline Gets or sets a value indicating whether this is a multiline TextBox control. Name Gets or sets the name of the control. PasswordChar Gets or sets the character used to mask characters of a password in a single-line TextBox control. Text Gets or sets the current text in the TextBox.
  • 13. In this project • Drag down a Textbox • Drag down three buttons from common controls • hello button (by clicking in this button it shows a messagebox (“hello”)) • exit button (by clicking in this button the application will be closed) • Hi button (by clicking in this button it will show “hi” in the textbox • Changing the backcolor , forecolor and font of button (from properties) • Changing the backcolor , forecolor and font of Textbox(from properties)
  • 14. private void button1_Click(object sender, EventArgs e) { MessageBox.Show("hello"); } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } private void button3_Click(object sender, EventArgs e) { textBox1.Text = "hi"; }
  • 15. • The most important characteristic of a label control is the text it displays. • That text is also referred to as its caption and this is what the user would read. • Important property is AutoSize.
  • 16. In this project • Drag down a three Textbox • Drag down a three Labels • Drag down four buttons from common controls • + button (by clicking in this button textbox3 will show the result of A+B • - button (by clicking in this button textbox3 will show the result of A-B • / button (by clicking in this button textbox3 will show the result of A/B • * button (by clicking in this button textbox3 will show the result of A*B • Changing the backcolor , forecolor and font of button (from properties) • Changing the backcolor , forecolor and font of Textbox(from properties) • Changing the backcolor , forecolor and font of Labels(from properties)
  • 17. int a, b, c; private void button3_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a / b; textBox3.Text = Convert.ToString(c); } private void button4_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a * b; textBox3.Text = Convert.ToString(c); }
  • 18. private void button2_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a - b; textBox3.Text = Convert.ToString(c); } private void button1_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a + b; textBox3.Text = Convert.ToString(c); }
  • 19. • PictureBox provides a rectangular region for an image. • It supports many image formats. • Allows you to include images on your form. • Important Properties: • Image (Browse to file) • Location • SizeMode • Normal, StretchImage, AutoSize, CenterImage, Zoom • BorderStyle
  • 21. presents an interface for date selection. It allows the user to select a valid DateTime without much effort on your part.
  • 22. In this project • Drag down a button (by clicking in the button a message will show the date ) • Drag down a dateTimePicker (by double click in the dateTimePicker you can change the date (year, month and day) private void button1_Click(object sender, EventArgs e) { MessageBox.Show(dateTimePicker1.Text); }
  • 23. private void Form1_Load(object sender, EventArgs e) { dateTimePicker1.CustomFormat = "ddd,dd-MM-yy"; dateTimePicker1.Format = DateTimePickerFormat.Custom; } Any format Example dd,mm,yy ddd-mmm-yyy