Eplan Platform API
Eplan.EplApi.EServices Namespace / PrjMessagesCollection Class / AddMessage Method / AddMessage(Region,Int32,String,StorableObject,Boolean,StorableObject,String) Method
A message of this IMessage.Region is added.
A message with this message number is added.
reference to a parameterstring to substitute placeholders in the resource error text. Multiple parameters must be separated with "|". In the error text parameters should be signed by "%1!s!", "%2!s!" etc. If the error text doesn't have any parameter to substitute strErrTextParam must be an empty string
The message refers to this object. Optional parameter; can also be NULL.
True: The message is immediately displayed in the message window.
A second object to which this message also refers. Optional parameter; can also be NULL.
Additional language\-independent message text. Is saved as specified in the database. Optional parameter; this string may also be empty.
Example

In This Topic
    AddMessage(Region,Int32,String,StorableObject,Boolean,StorableObject,String) Method
    In This Topic
    Adds a new message to the database with electrotechnical messages (Project data\Messages\Management). Any existing message from the system can be added as well as messages registered by an add-in.
    Syntax

    Parameters

    eRegion
    A message of this IMessage.Region is added.
    nErrNr
    A message with this message number is added.
    strErrTextParam
    reference to a parameterstring to substitute placeholders in the resource error text. Multiple parameters must be separated with "|". In the error text parameters should be signed by "%1!s!", "%2!s!" etc. If the error text doesn't have any parameter to substitute strErrTextParam must be an empty string
    oObject1
    The message refers to this object. Optional parameter; can also be NULL.
    bImmediateShow
    True: The message is immediately displayed in the message window.
    oObject2
    A second object to which this message also refers. Optional parameter; can also be NULL.
    strAdditionalInfo
    Additional language\-independent message text. Is saved as specified in the database. Optional parameter; this string may also be empty.
    Exceptions
    ExceptionDescription
    Thrown when eRegion is ePRJMSG_REGION_UNKNOWN.
    Remarks
    In order to add an error message to the system messages list, please refer to the method Eplan.EplApi.Base.BaseException.FixMessage.
    Example
    The following example shows how to append the new message 999025 to the message database of the current project.
        PrjMessagesCollection oPrjMessagesCollection = new PrjMessagesCollection(m_oTestProject);
        if (m_oTestProject == null)
    {
        ProjectManager oProjManager = new ProjectManager();
        m_oTestProject = oProjManager.CurrentProject;
    }
    
        if (m_oTestProject != null)
    {
        Page[] arrPages = m_oTestProject.Pages;
        Function[] arrFunction = arrPages[5].Functions;
    
        StorableObject oObject1 = arrFunction[0];
        StorableObject oObject2 = arrFunction[1];
    
        ProjectMessage oProjectMessage = oPrjMessagesCollection.AddMessage(Eplan.EplApi.EServices.IMessage.Region.Externals, 25, "XYZ", oObject1, false, oObject2, "Additional Text");
        Console.WriteLine(" Addded message " + oProjectMessage.GetText() + " to the project");
    }
    
    
    See Also