Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Help]Message Box[Solved]

[Help]Message Box[Solved]

Posts 1–15 of 17 · Page 1 of 2
o0OpurezO0o
o0OpurezO0o
[Help]Message Box[Solved]
I was trying to make a notepad with a Advance save system, the code is:

MsgBox("Do you want to Save?", vbQuestion+vbYesNoCancel, "Do you want to Save?")

If MsgBoxResult.Yes then
*Private Coding*
End If

If MsgBoxResult.No Then
End
End If

If MsgBoxResult.Cancel Then
Stop
End If

It keeps skipping and going to the save if i hit "No" or "Cancel".

Whats wrong? Anything Missing?
#1 · 15y ago
willrulz188
willrulz188
If MsgBoxResult.Yes then
*Private Coding*
End If

'Nothing else so you dont need it

If MsgBoxResult.Cancel Then
Exit sub
'or e.cancel
End If
#2 · edited 15y ago · 15y ago
Hassan
Hassan
Code:
Dim i As Integer = MsgBox("Do you want to Save?", vbQuestion+vbYesNoCancel, "Do you want to Save?")
If i = 2 Then
Stop
Elseif i=6 Then
*Private Coding*
Elseif i = 7 Then
End
End If
#3 · 15y ago
o0OpurezO0o
o0OpurezO0o
it still goes to the "Yes" Command.

Does anyone know?


Thanks Haddson.
#4 · edited 15y ago · 15y ago
Hassan
Hassan
Quote Originally Posted by o0OpurezO0o View Post
it still goes to the "Yes" Command.

Does anyone know?


Thanks Haddson.
No Problem. Btw, my name's Hassan xD !
#5 · 15y ago
Blubb1337
Blubb1337
Haddson....ahahahaha
#6 · 15y ago
Hassan
Hassan
Quote Originally Posted by Blubb1337 View Post
Haddson....ahahahaha
Lol'd too. Get on MSN -.-
#7 · 15y ago
willrulz188
willrulz188
Quote Originally Posted by o0OpurezO0o View Post
it still goes to the "Yes" Command.

Does anyone know?


Thanks Haddson.
maybe because its already saved
#8 · 15y ago
Hassan
Hassan
Quote Originally Posted by willrulz188 View Post
maybe because its already saved

#9 · 15y ago
T0
T0P-CENT
Code:
Dim Msgbox1 As DialogResult = MsgBox("AHAHAHA", MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, "AHAHA")
        If Msgbox1 = Windows.Forms.DialogResult.Yes Then
            MsgBox("You Pressed YES")
        ElseIf Msgbox1 = Windows.Forms.DialogResult.No Then
            MsgBox("You Pressed NO")
        ElseIf Msgbox1 = Windows.Forms.DialogResult.Cancel Then
            MsgBox("You Pressed CAncel")
        End If
#10 · 15y ago
NextGen1
NextGen1
Code structure is wrong. In your code you have

[highlight=vbnet]
MsgBox("Do you want to Save?", vbQuestion+vbYesNoCancel, "Do you want to Save?")
If MsgBoxResult.Yes then
*Private Coding*
End If
If MsgBoxResult.No Then
End
End If
If MsgBoxResult.Cancel Then
Stop
End If
[/highlight]

It should be

[highlight=vbnet]
Dim Result As DialogResult
Result = MessageBox.Show("Do you want to save?", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
'This will check what was clicked inside the dialog box declared as result
If Result = vbYes Then
'Your Code
ElseIf Result = vbNo Then
'Something else
ElseIf Result = vbCancel Then
'do nothiing
End If
[/highlight]

There should be no issues, let me know.

Fact is , it's all about the code and how it is structured, If statements should not end until you are done checking for what you want to check for.

In the same way a real If-->then Statement works.

If I have an apple
I have an Orange
Elseif I have a pinapple
I do not have a apple
----------------------
I do not have an Pineapple.

What is then true?
You can check to see if I have an apple, and can assume I do, but you will also have to continue to check and see If I have an orange (which I do) if you end the check there, you will never find that I have an orange

abstract explanation, but hopefully you understand.
Plus it is best to declare the result anyway



#11 · edited 15y ago · 15y ago
BO
Born2Amuse
Yes, the best way is to declare the result if you the possibility of more than two return types, otherwise you can use the following format:
[highlight=vbnet]If Msgbox("Do you want to retry ?", MsgBoxStyle.YesNo,"Msgbox Test")=MsgboxResult.vbYes Then
Msgbox("You pressed Yes")
Else
Msgbox("You pressed No")
End If[/highlight]
Can save some lines, but doesn't really matter.
#12 · 15y ago
NextGen1
NextGen1
Kinda does matter, But irrelevant,

in either case however, By declaring it first you leave yourself open for numerous options and many ways to use it, your way is static, used for yesno only, in this case we can use
Okonly,Yesno,YesNoCancel,Okcanel, You get the idea. Yours wouldn't even work with his scenario.



#13 · edited 15y ago · 15y ago
BO
Born2Amuse
Let me quote my self:

Yes, the best way is to declare the result if you the possibility of more than two return values.
You should've read that before giving me a lecture. Thank you.
*Correction in bold*.
#14 · 15y ago
Hassan
Hassan
Quote Originally Posted by Born2Amuse View Post
Let me quote my self:

Yes, the best way is to declare the result if you the possibility of more than two return values.
You should've read that before giving me a lecture. Thank you.
*Correction in bold*.
Well, you are right but you can't argue with him. Get used to it already.
#15 · 15y ago
Posts 1–15 of 17 · Page 1 of 2

Post a Reply

Tags for this Thread

None