Hi ! Can you guide me to change the colour of a message box. that is by default it is always blue. i want to change it to another color. plzzz help

NBox.MB_TitleBarColor = System.Drawing.Color.Orange
    NameOfBox.MB_BoxColor = System.Drawing.Color.LightSeaGreen
    NameOfBox.MB_BoxShadowColor = System.Drawing.Color.LightSalmon
    NameOfBox.MB_TitleFontColor = System.Drawing.Color.Maroon
    NameOfBox.MB_TitleFontName = "Arial"
    NameOfBox.MB_TitleFontBold = True
    NameOfBox.MB_ImageBorderSize = 5
    NameOfBox.MB_ImageBorderColor = System.Drawing.Color.Red
    NameOfBox.MB_ImageBorderStyle = BorderStyle.Double

    NameOfBox.MB_ButtonBackColor = System.Drawing.Color.Green
    NameOfBox.MB_ButtonBorderColor = System.Drawing.Color.Red
    NameOfBox.MB_ButtonBorderWidth = 4
    NameOfBox.MB_ButtonBorderStyle = BorderStyle.Double
    NameOfBox.MB_ButtonForeColor = System.Drawing.Color.Yellow
    NameOfBox.MB_ButtonFontBold = True
    NameOfBox.MB_BorderWidth = 5
    NameOfBox.MB_BorderStyle = BorderStyle.Double
    NameOfBox.MB_BorderColor = System.Drawing.Color.Honeydew
    Panel1.Controls.Add(NBox)

basically, use the lines above and change color by setting them equal to "System.Drawing.Color.(actual color)". Oh, this is VB.NET and inside a private function in a vb script.

Enjoy

How are you displaying your messages using ASP.NET... show us the code so that we can help:)

If you're using javascript alert or confirm you are stuffed you can't control the style it is part of the users system and therefore controled by their current theme, browser skin etc.

You will have to create your own 'pop-up' by dynamicaly creating an absolute positioned div add some controls to it and make it visible when required by setting its left, top and visibility style properties.

But if you are using VB, then this goes in your "pagename.aspx.vb" file. You have to create a function for it to be called when clicked via javascript. It will pop up your box and be dynamically edited for appearance.

Do a search on google for "asp.net vb message box" and you will find what you need.

This article has been dead for over six months. Start a new discussion instead.