Example Code

Creating Custom Error Messages in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This simple code demonstrates how you can programmatically redefine the error number in your error cluster and then how you can display your own custom message based on that number.

 

Description

Sometimes it is useful to have LabVIEW generate your own custom error message.  For example, you might not want your user to see LabVIEW's default message for Error 7.  Instead, you might want to deliver a more specific message to your user like "Please enter a valid file path." 

 

Requirements

  • LabVIEW 2012(or compatible)

 

Steps to Implement or Execute Code

  1. Define your preferred value for the "Use Custom Message?" boolean.
  2. Enter your preferred error message.
  3. Run the VI.

 

Additional Information or References

VI Snippet

 BD.png 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Michael B.
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
NishantPatel
Member
Member
on

Hello there,

Can you post LV2011 version as well?