Example Code

LabVIEW Drag and Drop Files

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 VI demonstrates how to drag and drop a file into the file path control and then programmatically check that file to make sure that it has a particular extension.


Description: There is no event in LabVIEW that handles a "drag-n-drop" event, but because string, file, and path I/O controls allow drag-n-drop of file names, the workaround is to handle the "Value Change" event on a particular I/O control and then handle the file extension of the file name that was added.


Requirements:  LabVIEW 2012 (or compatible). Hardware: none.


Steps to Implement or Execute Code:

1. Run the VI.
2. Drag and drop a file in the Path control below.
3. The indocator show if it is an *.ini file and stops the VI if true.


Additional Information or References: 

 

LabVIEW Drag and Drop Files FP.png

 

LabVIEW Drag and Drop Files BD.png


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

Regards,
Dan King

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