Print Page | Close Window

MessageBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=10576
Printed Date: 07 October 2024 at 10:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MessageBar
Posted By: moe188
Subject: MessageBar
Date Posted: 09 May 2008 at 2:41pm
Hello,
how can I be able to change the colored string in the messagebar in run-time:
 
Private Sub CreateMessageBar()
   
    Dim MessageBar As MessageBar
    Set MessageBar = CommandBars.MessageBar
    MessageBar.Visible = True
   
    MessageBar.AddCloseButton "close..."
   
    MessageBar.AddButton 1000, "Options...", "Show more options"
    MessageBar.Message = _
        "<StackPanel Orientation='Horizontal'>" & _
        "        <Image Source='10000'/>" & _
        "        <TextBlock Padding='3, 0, 0, 0' VerticalAlignment='Center'><Bold>Informations</Bold></TextBlock>" & _
        "        <TextBlock Padding='10, 0, 0, 0' VerticalAlignment='Center'>About the message.</TextBlock>" & _
        "</StackPanel>"
End Sub
 
thank you



Replies:
Posted By: Oleg
Date Posted: 10 May 2008 at 4:27am
Hi,
 
You can replace Message string with new markup:
 
MessageBar.Message = _
        "<StackPanel Orientation='Horizontal'>" & _
        "        <Image Source='10000'/>" & _
        "        <TextBlock Padding='3, 0, 0, 0' VerticalAlignment='Center'><Bold>Informations</Bold></TextBlock>" & _
        "        <TextBlock Padding='10, 0, 0, 0' VerticalAlignment='Center' Foreground='Red'>About the message.</TextBlock>" & _
        "</StackPanel>"


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Bernie
Date Posted: 11 May 2008 at 10:29am
Try my Code:
 
Public Sub ShowMessage(ByVal MSG As String, Optional ByVal TextColor As String = "'Red'", Optional ByVal IsVisible As Boolean = True, Optional ByVal ButtonCaption As String)
      MSGBar.Message = "<StackPanel Orientation='Horizontal'><TextBlock Padding='8, 0, 0, 0' FontSize='12' Foreground='" & TextColor & "'>" & MSG & "</TextBlock></StackPanel>"
      MSGBar.Visible = IsVisible
      If ButtonCaption <> "" Then
            MSGBar.AddButton 801, ButtonCaption, ButtonCaption
      Else
            MSGBar.RemoveButtons
      End If
End Sub


-------------
Bernie Ho, Planning Manager + IELTS specialist + part-time programmer
Taiwan, R.O.C



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net