Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am working in the vb.net i don't know how to use message box and why we use parameters pls explain me
Posted
Updated 1-Feb-12 21:08pm
v2

Try:
VB
MessageBox.Show("This is what happened")


VB
MessageBox.Show("This is what happened", "This is what you tried to do")


VB
MessageBox.Show("This is what happened", "This is what you tried to do", giveHimTheseButtons)


VB
If MessageBox.Show("This is what happened", "This is what you tried to do", MessageBoxButtons.YesNo) = DialogResult.Yes Then
   ...
End If
 
Share this answer
 
Comments
Dave Kreskowiak 2-Feb-12 10:13am    
I have to give you credit on this one. I couldn't answer this one without being condescending. Really, how hard is it to type "MessageBox" into any search engine??
there are 2 ways to create messageboxes in VB.NET

1. The old school way. I advise you not to use this. (just showing you for the sake of letting you know)

VB
MsgBox("This is a message", vbOKOnly, "Title")


the 2nd (button style) and the 3rd (caption) parameters are optional.


2. This is the preferable way to show a messagebox.

VB
MessageBox.Show("This is a message", "Title", MessageBoxButtons.OK, MessageBoxIcon.Information)


the 2nd (caption), 3rd (button style) and the 4th (icon) are optional.
 
Share this answer
 
See this link, for Different message boxes
http://www.dotnetperls.com/messagebox-show-vbnet[^]

Thanks
--RA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900