Results 1 to 6 of 6

Thread: Change Message Box properties

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    ENGLAND
    Posts
    38

    Change Message Box properties

    Dear All
    I like to change the MessageBox properties in VB.NET code
    such as; Font,Text Color,Back Color,Fore Color ect.
    Many Thanks for any Reply
    salih
    sa

  2. #2
    Addicted Member
    Join Date
    Mar 2001
    Location
    Devon, UK
    Posts
    181
    Just with any other object in .Net you can sub class it to create your own variant. Just create a class cMsgBox which inherits from the messagebox object then play away! This is an example of a treenode

    Public Class cTreeNode
    'Subclass by inheriting the TreeNode
    Inherits TreeNode
    'each of the below public declarations will be "visible" to the outside
    Public m_caType As Catergories
    Public m_sName As String
    Public m_sExtra As String
    Public m_iChildren As Int32
    Public m_iDBID As Int32

    Sub New(ByVal caType As Catergories, ByVal sName As String, ByVal iDBID As Int32, ByVal iImageIndex As Int32, ByVal iSelectedImageIndex As Int32, Optional ByVal sExtra As String = Nothing, Optional ByVal iChildren As Int32 = Nothing)
    MyBase.New()
    'transfer all incoming parameters to your local storage
    m_caType = caType
    m_sName = sName
    m_sExtra = sExtra
    m_iChildren = iChildren
    m_iDBID = iDBID
    'and finally, pass back the TreeNode.Text property
    Me.Text = m_sName & m_sExtra
    Me.SelectedImageIndex = iImageIndex
    Me.ImageIndex = iSelectedImageIndex
    End Sub

    End Class
    Wind and waves resolves all problems.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    ENGLAND
    Posts
    38

    Change MessageBox Properties

    Hi cim3
    Thank you very much for your reply
    but is there any chance to modify to MessageBox Class
    that would be very very helpful
    I am new to .NET
    SALIH
    sa

  4. #4
    Addicted Member
    Join Date
    Mar 2001
    Location
    Devon, UK
    Posts
    181
    Can't seem to do it using the method i posted. I'm intrigued now, anyone shed any light on this subject. Get the message on mybase.new, does this mean that the messagebox object can't be inherited?

    'System.Windows.Forms.MessageBox.Private Overloads Sub New()' is not accessible in this context because it is 'Private'.
    Wind and waves resolves all problems.

  5. #5
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    Does anyone have any additional information on this? The message box that comes up on my app looks terrible - out of place since the form behind has it's back color changed. Any way to make this look better?

    Thanks

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Just design your own
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width