SlideShare a Scribd company logo
. Net
Technologies
INSTRUCTOR:
ELLEN GRACE PORRAS
2
Writing the Code
3
The messagebox function enables you to display a
message box for which you have designated the
format and content. You can specify the number
and type of buttons on the message box, the
message icon (for example, hand, question mark,
exclamation point, or asterisk), and the message
displayed.
The messagebox function
4
To create a message box using the .NET Framework, you can call the Show()
method of the MessageBox class using the following formula:
MessageBox.Show(Message)
Syntax:
MessageBox.Show (“Hello World”)
5
A message box has the following parts:
6
A message box has the following parts:
1.Title: This is typically used to display what the message box is
about. If you don’t specify anything, it displays the application name
– which is Microsoft Excel in this case.
2.Prompt: This is the message that you want to display. You can use
this space to write a couple of lines or even display tables/data here.
3.Button(s): While OK is the default button, you can customize it to
show buttons such as Yes/No, Yes/No/Cancel, Retry/Ignore, etc.
4.Close Icon: You can close the message box by clicking on the close
icon.
7
MessageBoxButtons
MessageBoxButtons.AbortRetryIgnore displays the Abort, Retry, and Ignore
buttons
MessageBoxButtons.OK displays the OK button
MessageBoxButtons.OKCancel displays the OK and Cancel buttons
MessageBoxButtons.RetryCancel displays the Retry and Cancel
buttons
MessageBoxButtons.YesNo displays the Yes and No buttons
MessageBoxButtons.YesNoCancel displays the Yes, No, and Cancel
8
A message box icon
9
MessageBoxDefaultButton
MessageBoxDefaultButton.Button1 the first message box button is the
default button
MessageBoxDefaultButton.Button2 the second message box button is the
default button
MessageBoxDefaultButton.Button3 the third message box button is the
default button
MessageBox.Show(“hi", "Title", MessageBoxButtons.YesNo,
MessageBoxIcon.Question)
10
Example using MessageBox.Show()
MessageBox.Show("The Last Name field must not be
blank.","Last name", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
11
Example using MessageBox.Show()
MessageBox.Show("A bad database error has
occurred.","UpdateCustomerTable",MessageBoxButtons.
OK,MessageBoxIcon.Error)
12
Example using MessageBox.Show()
Dim MyResponse As DialogResult
MyResponse = MessageBox.Show("Are you sure you want to quit?","Quit",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If MyResponse = DialogResult.Yes Then
Application.Exit()
'end the program
End If
13
Example using MessageBox.Show()
Dim MyAnswer As DialogResult
MyAnswer = MessageBox.Show(“Are you a BSIT Student?",“Question",
MessageBoxButtons.YesNo,MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2)
If MyAnswer = DialogResult.Yes Then
MessageBox.Show(“Hello BSIT”)
Else
Application.Exit()
End If
14
Example using MessageBox.Show()
Dim MyAnswer As DialogResult
MyAnswer = MessageBox.Show(“Are you a BSIT Student?",“Question",
MessageBoxButtons.YesNo,MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2)
If MyAnswer = DialogResult.Yes Then
MessageBox.Show(“Hello BSIT”)
Else
Application.Exit()
End If
15
Example using MessageBox.Show()
Dim MyAnswer As DialogResult
MyAnswer = MessageBox.Show(“Are you a BSIT Student?",“Question",
MessageBoxButtons.YesNo,MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2)
If MyAnswer = DialogResult.Yes Then
MessageBox.Show(“Hello BSIT”)
Else
Application.Exit()
End If
16
Example using MessageBox.Show()
Answer the following on a 1 whole sheet of paper. Use declaration
of variables.
1. Write a program that will allow you to enter your Age on
TextBox1. If Button1 is clicked, display on a MessageBox the
prompt “Your Age is “ then your Age. Title is Age, Button is
Ok, Icon is Information.
17
Let’s check your knowledge
Answer for number 1
Dim Age as Integer
Age= TextBox1.Text
MessageBox.Show(“Your Age is ” & Age, “Age”,
MessageBoxButtons.Ok, MessageBoxIcon.Information)
18
Let’s check your knowledge
Answer the following on a 1 whole sheet of paper. Use declaration
of variables.
2. Write a program that will multiply numbers on TextBox1 and
TextBox2, then display the answer on a MessageBox with a prompt
“The answer is “ then the answer, Title is Product, Button is Ok,
and Icon is Information.
19
Let’s check your knowledge
Answer for number 2
Dim num1, num2, ans As Integer
num1 = TextBox1.Text
num2 = TextBox2.Text
ans = num1 * num2
MessageBox.Show("The answer is " & ans, "Product",
MessageBoxButtons.YesNo, MessageBoxIcon.Information)
20
Let’s check your knowledge
Answer the following on a 1 whole sheet of paper. Use declaration
of variables.
3. Write a program that will allow you to enter your first name
on Textbox1, Last name on TextBox2. If Button1 is clicked,
display on a MessageBox the prompt “Are you “ then your Full name
with a question mark. Title is Name, Buttons are YesNo, Icon is
Question.
If DialogResult is Yes, Display on a MessageBox the prompt “Hello
there “ then your Full Name, Title is Name, Button is Ok, Icon is
Information.
21
Let’s check your knowledge
Answer for number 3
Dim FN, LN, FUllN As String
Dim MyName As DialogResult
FN = TextBox1.Text
LN = TextBox2.Text
FUllN = FN & " " & LN
MyName = MessageBox.Show("Are you " & FUllN & "?", "Name",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If MyName = DialogResult.Yes Then
MessageBox.Show("Hello there " & FUllN, "Name",
MessageBoxButtons.OK)
End If
22
Let’s check your knowledge
Thank you
Presenter name: Ellen Grace D. Porras
Email address: egporras@psu.palawan.edu.ph

More Related Content

PPTX
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
PPTX
Chapter ii c#(building a user interface)
PPTX
5 Laboratory Basic Calculator using Visual basic.pptx
PDF
Membuat aplikasi penjualan buku sederhana
PPTX
Lesson 5 Introduction to Human Computer Interaction
PPTX
Functions 1
PPT
Creating a quiz using visual basic 6
DOCX
Tutorials on Macro
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
Chapter ii c#(building a user interface)
5 Laboratory Basic Calculator using Visual basic.pptx
Membuat aplikasi penjualan buku sederhana
Lesson 5 Introduction to Human Computer Interaction
Functions 1
Creating a quiz using visual basic 6
Tutorials on Macro

Similar to .Net Technologies MessageBox using Visual basic.pptx (20)

PDF
Inventory management
PDF
Create formsexcel
PPTX
Vs c# lecture1
PDF
I need some help answering these three questions listed below.1. A.pdf
DOCX
The visual studio start page is shown in the figure below
PPTX
Lecture 7: introduction to computer
DOCX
Visual C# 2010
DOCX
Hw8Excel - Exercise 8 Mail Merge-2.docINFS 3250In Class Pro.docx
PPTX
Project advance itt
PPT
Introduction microsoft excel 2007
PDF
Create yourfirstandroidapppdf
PPTX
How to use a spreadsheet
PPT
INPUT BOX- VBA
PPTX
Dialog box in vb6
PPTX
XMetaL Dialog Odds & Ends
PDF
Conditional Logic: Exercises
PDF
projectadvanceitt-150707174943-lva1-app6891.pdf
DOCX
Visual basic bt0082
PPTX
Function 2
DOCX
You have been engaged to develop a special calculator program. T.docx
Inventory management
Create formsexcel
Vs c# lecture1
I need some help answering these three questions listed below.1. A.pdf
The visual studio start page is shown in the figure below
Lecture 7: introduction to computer
Visual C# 2010
Hw8Excel - Exercise 8 Mail Merge-2.docINFS 3250In Class Pro.docx
Project advance itt
Introduction microsoft excel 2007
Create yourfirstandroidapppdf
How to use a spreadsheet
INPUT BOX- VBA
Dialog box in vb6
XMetaL Dialog Odds & Ends
Conditional Logic: Exercises
projectadvanceitt-150707174943-lva1-app6891.pdf
Visual basic bt0082
Function 2
You have been engaged to develop a special calculator program. T.docx
Ad

More from EllenGracePorras (20)

PPTX
Lesson 6 Information Management for BSIT.pptx
PPTX
Information Management for BSIT Students.pptx
PPTX
.Net Technologies - Visual Basic . Net.pptx
PPTX
Geographic Information System Lesson 6 IT
PPTX
Lesson 6 Introduction to Human Computer Interaction.pptx
PPTX
Lesson 3 Introduction to Human Computer Interaction.pptx
PPTX
Geographic Information Systems GIS for BSIT
PPTX
Lesson 3 Introduction to Human Computer Interaction.pptx
PPTX
Lesson 4 Introduction to Human Computer Interaction.pptx
PPTX
Geographic Information System(GIS).pptx
PPTX
Geographic Information Systems (GIS).pptx
PPTX
Advanced Database Systems.pptx
PPTX
Data Manipulation Language.pptx
PPTX
Advanced Database Systems - Presentation 4.pptx
PPTX
Advanced Database Systems - Presentation 3.pptx
PPTX
Advanced Database Systems - Presentation 2.pptx
PPTX
Advanced Database Systems - Presentation 1 with quiz.pptx
PPTX
Structured Query Language (SQL) Part 2.pptx
PPTX
SQL Where Clause.pptx
PPTX
SQL Statements.pptx
Lesson 6 Information Management for BSIT.pptx
Information Management for BSIT Students.pptx
.Net Technologies - Visual Basic . Net.pptx
Geographic Information System Lesson 6 IT
Lesson 6 Introduction to Human Computer Interaction.pptx
Lesson 3 Introduction to Human Computer Interaction.pptx
Geographic Information Systems GIS for BSIT
Lesson 3 Introduction to Human Computer Interaction.pptx
Lesson 4 Introduction to Human Computer Interaction.pptx
Geographic Information System(GIS).pptx
Geographic Information Systems (GIS).pptx
Advanced Database Systems.pptx
Data Manipulation Language.pptx
Advanced Database Systems - Presentation 4.pptx
Advanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 2.pptx
Advanced Database Systems - Presentation 1 with quiz.pptx
Structured Query Language (SQL) Part 2.pptx
SQL Where Clause.pptx
SQL Statements.pptx
Ad

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
August Patch Tuesday
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Machine Learning_overview_presentation.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
SOPHOS-XG Firewall Administrator PPT.pptx
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
August Patch Tuesday
Heart disease approach using modified random forest and particle swarm optimi...
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25-Week II
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
MIND Revenue Release Quarter 2 2025 Press Release
Digital-Transformation-Roadmap-for-Companies.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Spectroscopy.pptx food analysis technology
Machine Learning_overview_presentation.pptx
Group 1 Presentation -Planning and Decision Making .pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

.Net Technologies MessageBox using Visual basic.pptx

  • 3. 3 The messagebox function enables you to display a message box for which you have designated the format and content. You can specify the number and type of buttons on the message box, the message icon (for example, hand, question mark, exclamation point, or asterisk), and the message displayed. The messagebox function
  • 4. 4 To create a message box using the .NET Framework, you can call the Show() method of the MessageBox class using the following formula: MessageBox.Show(Message) Syntax: MessageBox.Show (“Hello World”)
  • 5. 5 A message box has the following parts:
  • 6. 6 A message box has the following parts: 1.Title: This is typically used to display what the message box is about. If you don’t specify anything, it displays the application name – which is Microsoft Excel in this case. 2.Prompt: This is the message that you want to display. You can use this space to write a couple of lines or even display tables/data here. 3.Button(s): While OK is the default button, you can customize it to show buttons such as Yes/No, Yes/No/Cancel, Retry/Ignore, etc. 4.Close Icon: You can close the message box by clicking on the close icon.
  • 7. 7 MessageBoxButtons MessageBoxButtons.AbortRetryIgnore displays the Abort, Retry, and Ignore buttons MessageBoxButtons.OK displays the OK button MessageBoxButtons.OKCancel displays the OK and Cancel buttons MessageBoxButtons.RetryCancel displays the Retry and Cancel buttons MessageBoxButtons.YesNo displays the Yes and No buttons MessageBoxButtons.YesNoCancel displays the Yes, No, and Cancel
  • 9. 9 MessageBoxDefaultButton MessageBoxDefaultButton.Button1 the first message box button is the default button MessageBoxDefaultButton.Button2 the second message box button is the default button MessageBoxDefaultButton.Button3 the third message box button is the default button
  • 11. MessageBox.Show("The Last Name field must not be blank.","Last name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) 11 Example using MessageBox.Show()
  • 12. MessageBox.Show("A bad database error has occurred.","UpdateCustomerTable",MessageBoxButtons. OK,MessageBoxIcon.Error) 12 Example using MessageBox.Show()
  • 13. Dim MyResponse As DialogResult MyResponse = MessageBox.Show("Are you sure you want to quit?","Quit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If MyResponse = DialogResult.Yes Then Application.Exit() 'end the program End If 13 Example using MessageBox.Show()
  • 14. Dim MyAnswer As DialogResult MyAnswer = MessageBox.Show(“Are you a BSIT Student?",“Question", MessageBoxButtons.YesNo,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) If MyAnswer = DialogResult.Yes Then MessageBox.Show(“Hello BSIT”) Else Application.Exit() End If 14 Example using MessageBox.Show()
  • 15. Dim MyAnswer As DialogResult MyAnswer = MessageBox.Show(“Are you a BSIT Student?",“Question", MessageBoxButtons.YesNo,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) If MyAnswer = DialogResult.Yes Then MessageBox.Show(“Hello BSIT”) Else Application.Exit() End If 15 Example using MessageBox.Show()
  • 16. Dim MyAnswer As DialogResult MyAnswer = MessageBox.Show(“Are you a BSIT Student?",“Question", MessageBoxButtons.YesNo,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) If MyAnswer = DialogResult.Yes Then MessageBox.Show(“Hello BSIT”) Else Application.Exit() End If 16 Example using MessageBox.Show()
  • 17. Answer the following on a 1 whole sheet of paper. Use declaration of variables. 1. Write a program that will allow you to enter your Age on TextBox1. If Button1 is clicked, display on a MessageBox the prompt “Your Age is “ then your Age. Title is Age, Button is Ok, Icon is Information. 17 Let’s check your knowledge
  • 18. Answer for number 1 Dim Age as Integer Age= TextBox1.Text MessageBox.Show(“Your Age is ” & Age, “Age”, MessageBoxButtons.Ok, MessageBoxIcon.Information) 18 Let’s check your knowledge
  • 19. Answer the following on a 1 whole sheet of paper. Use declaration of variables. 2. Write a program that will multiply numbers on TextBox1 and TextBox2, then display the answer on a MessageBox with a prompt “The answer is “ then the answer, Title is Product, Button is Ok, and Icon is Information. 19 Let’s check your knowledge
  • 20. Answer for number 2 Dim num1, num2, ans As Integer num1 = TextBox1.Text num2 = TextBox2.Text ans = num1 * num2 MessageBox.Show("The answer is " & ans, "Product", MessageBoxButtons.YesNo, MessageBoxIcon.Information) 20 Let’s check your knowledge
  • 21. Answer the following on a 1 whole sheet of paper. Use declaration of variables. 3. Write a program that will allow you to enter your first name on Textbox1, Last name on TextBox2. If Button1 is clicked, display on a MessageBox the prompt “Are you “ then your Full name with a question mark. Title is Name, Buttons are YesNo, Icon is Question. If DialogResult is Yes, Display on a MessageBox the prompt “Hello there “ then your Full Name, Title is Name, Button is Ok, Icon is Information. 21 Let’s check your knowledge
  • 22. Answer for number 3 Dim FN, LN, FUllN As String Dim MyName As DialogResult FN = TextBox1.Text LN = TextBox2.Text FUllN = FN & " " & LN MyName = MessageBox.Show("Are you " & FUllN & "?", "Name", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If MyName = DialogResult.Yes Then MessageBox.Show("Hello there " & FUllN, "Name", MessageBoxButtons.OK) End If 22 Let’s check your knowledge
  • 23. Thank you Presenter name: Ellen Grace D. Porras Email address: egporras@psu.palawan.edu.ph