Message Box
Use this board to post your code snippets - tips and tricks
4 posts
Page 1 of 1
Although most of you already know how to do this, I will still post this for the VB ''newbs''.
cya wahooo;
Code: Select all
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Do you want to continue?" ' Message you want to display
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Demonstration" ' Msgbox title
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then 'if user choses yes
' Doe iets.
Else
' Doe iets.
End If
cya wahooo;
Siplified version
MsgBox("Do you want to continue?", MsgBoxStyle.Critical, "MsgBox Demonstration")
You could do that but your code is cool aswell ;)
MsgBox("Do you want to continue?", MsgBoxStyle.Critical, "MsgBox Demonstration")
You could do that but your code is cool aswell ;)
it has the option for yes or no besides clicking no and still continuing
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

I use this a ton but do it a lil different lol shorter version but both are nice =p
Dim answer As Integer
answer = MsgBox("Would you like to close", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
If answer = vbYes Then
Me.Close()
Else
Me.Show()
End If
Dim answer As Integer
answer = MsgBox("Would you like to close", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
If answer = vbYes Then
Me.Close()
Else
Me.Show()
End If
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023