c# - Show MessageBox immediately in Windows Forms? -
is there way have messagebox pop when form opens? want display short message how use form when opens. tried
private void myform_load(object sender, eventargs e) { dialogresult dialogopen = messagebox.show("use navigation menu started.", "welcome!", messageboxbuttons.ok); } but doesn't work.
i don't see why wouldn't work in form_load. try doing others have pointed out putting beneath form initialization.
though, given you're showing message box, don't think there reason store result, simple messagebox.show(message); should trick.
as @s.m. said, ux point of view, having notification thrown in face app starts obnoxious, @ least if have every time. personally, create boolean settings variable, set true first time message displayed, , display when setting false, i.e. first time message displayed.
private boolean splashshown = properties.settings.default.splashshown; private void form_load(object sender, eventargs e) { if (!splashshown) { messagebox.show("message"); myform.properties.settings.default.splashshown = true; myform.properties.settings.default.save(); } } and set splashshown setting in form properties.
if problem form_load() method isn't attached form.load() event, can double click form window in designer , automatically created form_load() base method , attach form.load() event
Comments
Post a Comment