Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
Hi all

Is there any way to change the appearance of the default Microsoft message box that's called by the MsgBox function e.g. my app has all its background colors set to white and the grey looks bad against so I would like to change the grey to white.

Any thoughts?

Thanks as always

Craftor

:cool:
 
This shouldn't keep anyone else from giving the poster the direct answer to the question as asked, but at this late date...

A simple thought: Use your own form, rather than the standard msgbox. (Write a public function to encapsulate the functionality, so that throughout most of your code, calling your own form looks right. Call it MessageBox or MsgBox2 or something clever like that; call it CoolBox if you think it's cool. (Perhaps someone has even done a good job of reproducing a lot of the functionality already; check around the forums for sure.)

I've already done (a little bit of) this, not for general use, but for specific messages that had to *really* get my users' attention. For instance, earlier today, I created a form with a label and a Timer event that changes the ForeColor of the label every half-second; when the form is called with OpenArgs, on load it sets label0.Caption = Me.OpenArgs. The result: The form opens with the message I passed as an argument (OpenArgs) displayed in flashing blue and purple.

Your function could accept parameters for any of the changeable properties of the form or its controls (colors sizes, fonts, pictures...), and should use defaults for optional arguments. Your function would open the form as a dialog, set the properties according to the parameters passed, then display the form.

If you *really* wanted your spiffy new MsgBox replacement to be portable by moving just the code, have the function actually create the form and controls on the fly, then destroy them when it gets closed.

If you don't get what you want an easier way, there is always that... [yoda] "Hard work might it be, but worth it, yeeeesss..." -- C Vigil =)
(Before becoming a member, I also signed on several posts as
"JustPassingThru" and "QuickieBoy" -- as in "Giving Quick Answers")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top