-
Mar 25th, 2023, 09:40 AM
#1
Thread Starter
Lively Member
[RESOLVED] Message box
Is there any way to display a messagebox with a question in it when a form starts up?
-
Mar 25th, 2023, 09:47 AM
#2
Re: Message box
by a question, you mean a text question and a field to answer it ? ( a bit like the former input box) or just a text with a question in it?
if it is the first , create a small form with a label and a textbox and call the form.
The best friend of any programmer is a search engine 
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Mar 25th, 2023, 10:01 AM
#3
Re: Message box
Please provide a FULL and CLEAR explanation of the problem. Of course you can display a question in a message box. It's just text like any other, so why would it be different? If what you're actually asking is how can the user answer the question then that's different. Say what you actually mean because, if you actually mean what you said then there's no problem to be solved.
-
Mar 25th, 2023, 03:34 PM
#4
Re: Message box
You can display a MsgBox with a question on startup. You can specify options such as iconquestion and messageboxbuttons.yesno and defaultbutton etc…
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 27th, 2023, 05:19 PM
#5
Thread Starter
Lively Member
Re: Message box
I was able to display the messagebox when the form started.
-
Mar 27th, 2023, 06:49 PM
#6
Re: Message box
 Originally Posted by wideminnow6970
I was able to display the messagebox when the form started.
That seems to suggest that your issue was more about doing something when a form was opened rather than about a message box. As you haven't actually specified what your solution was, so it can't help anyone else and we also don't know whether there's a better option, I'll provide options for that.
A form has a Load event and a Shown event. The former is raised just before the form is displayed for the first time and the latter is displayed just after. If you want something to happen at those moments in the form's lifecycle, do it in the appropriate event handler. Note that, once you call Show/ShowDialog and the Load event is raised, the form is going to be displayed. If you're asking the user a question that will affect whether or not you want the form displayed, you need to do it before calling Show/ShowDialog in the first place. If you want to do something before the application's startup form is created, handle the Startup event of the application. That allows you to cancel the event and exit the application without ever creating the startup form is you desire.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|