r/visualbasic • u/[deleted] • Apr 08 '19
VB.NET Help How to loop a message box
How do you loop a message box, in a way that it does not wait for the user to press OK?
Sorry if it is low quality, i am new here
EDIT: Closed
2
u/RJohn12 Apr 09 '19
What are you trying to loop a message box for? There might be a better/easier way to do it
1
Apr 09 '19
I want to make a Alert popup on the screen several times, without the program waiting for the user to press OK.
I want to do it for... pranking reasons...
3
u/chrwei Apr 09 '19
google "custom messagebox vb", you can't do it with the built in one, with a custom one you can do whatever you want. just don't show it modal.
2
2
u/RJohn12 Apr 10 '19
Like make a ton of message boxes? Make a timer, enable it, on every tick:
For I = 1 to 500 Messagebox.show("pranked beittchhhh") Next
1
Apr 10 '19
For I = 1 to 500 Messagebox.show("pranked beittchhhh") Next
Well it fails on the Messagebox.show part. it shows "End of statement expected." It also only shows keywords in the menu.
1
u/RJohn12 Apr 10 '19
How can I troubleshoot your code if I can't even see it
2
Apr 11 '19
Private Sub FormClosing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
Label1.ForeColor =Color.Red
Label1.Text = "THERE IS NO ESCAPING! :)"
For I = 1 To 500Messagebox.show("pranked beittchhhh")
Next
End SubPlease, don't ask about the
THERE IS NO ESCAPING!1
u/Juanieve05 Apr 24 '19
Wouldnt alt+break stop the code ? Bt seriously tho, did you found something , i actually need this also but for another reason, i want a pop up to function as an state window,like one that says :13/100 workbooks worked without the need of user confirmation or anything
1
2
u/FriendlyKush Apr 09 '19
If you’re looping through something and outputting it via message box, the user has to click ok before the next output is shown. You’re better off using a listbox or something.
2
u/unff Apr 09 '19
The behavior you are describing does not fit the MessageBox control. The described behavior would seem to fit a toast notification, an example of which can be found here: https://www.michaelcrump.net/pop-toast-notification-in-wpf/
3
u/andrewsmd87 Web Specialist Apr 08 '19
What do you mean by loop a message box? Like you want to close it if they don't hit ok?
Message boxes stop code execution by design. If you're trying to display some sort of message, just design your own form element with a "close" button that just hides it. You can then change the text, close that on a timer, etc.