Yes or No ? [VB08]

Use this board to post your code snippets - tips and tricks
8 posts Page 1 of 1
Contributors
User avatar
TheET
VIP-Member
VIP-Member
Posts: 105
Joined: Sun Nov 01, 2009 2:41 am

Yes or No ? [VB08]
TheET
Hi ,

In this tutorial ,
You will learn how to use MessageBox Yes or No function in Visual Basic 2008 . I have made it as easy as possible . So , let's get started .

----------------------------Tutorial Starts--------------------------------
1. As usual , open up Visual Basic 2008 > Create a new project > Place a button on the form

2. Double click on the button & paste in this code
Code: Select all
Dim result As MsgBoxResult
            result = MsgBox("Click yes or no", MessageBoxButtons.YesNo, "Title")
            If result = MsgBoxResult.Yes Then
                        msgbox("You clicked YES!")
                else
                         msgbox("You clicked NO!")
             End if
That's it . You can further enhance this code to your needs . I'm just giving you an opinion to how to do it .
-----------------------------Tutorial Ends-------------------------------

wahooo; Hope you like it ! Cheers

TheET.
Lewis
Coding God
Coding God
Posts: 1564
Joined: Sun Dec 20, 2009 2:12 pm

Re: Yes or No ? [VB08]
Lewis
Well i must say i think thats the shortest i have seen it done, but i dunno, Thanks for the tutorial Now i know how to code that :D
Image
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 445
Joined: Tue Feb 16, 2010 6:24 am

Re: Yes or No ? [VB08]
Livengood
Nice Job :)
Was woundering how i could do this..
Image
User avatar
35000vr
Top Poster
Top Poster
Posts: 176
Joined: Sat Mar 06, 2010 5:09 pm

Re: Yes or No ? [VB08]
35000vr
yeah and i was wondering too.
‼ <----- Copy it,it is together and if you backspace it it will both erase
☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"<-----Some Cool symbols.
♂<-----Boy Symbol :)
²ƽ<--------Mini 2 and 5!
ð<----Not sure what it is.
☺☻<-----Smiles
♪♫<----Music Notes
Others:ß┬ƒ○║■ã¿┼↑
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Yes or No ? [VB08]
Agust1337
lol you can do this to ^^:
Code: Select all
Dim m = msgbox("Are you gonna exit me :(?, MsgboxStyle.YesNo)
If  m = vbYes Then
         me.close
End if 
No need to use the No ^^ it wont do anything :P
Top-notch casual Dating
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Yes or No ? [VB08]
mandai
You can also change the DialogResult property of a button already on a form - so when you call Form1.ShowDialog() you can do the same thing but it could be using your own layout for the dialog.
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1892
Joined: Wed Dec 16, 2009 9:56 pm

Re: Yes or No ? [VB08]
zachman61
is there a way to do this with messageboxEx by DotNetBar
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Yes or No ? [VB08]
mandai
Can't say I've used DotNetBar before but according to MSDN the MessageBoxEx and MessageBox functions work the same way.
8 posts Page 1 of 1
Return to “Quick Snips”