User`s guide

Using .NET with VEE 7
VEE User’s Guide 309
Lab 7-3: Using .NET to Get File Information
The .NET System.IO namespace provides a tremendous
amount of functionality for dealing with the file system. This
functionality is more accessible than ever. In this exercise,
you will query a file about its creation time, last access time,
and length. The complete example is in examples\dotnet\
FileInfo.vee.
1 Choose Device .NET Assembly References.
2 From the .NET tab, select the mscorlib checkbox. Choose
OK.
3 If the Import .NET Namespaces dialog box comes up, you may
check the System namespace, or just choose Cancel. In this
Lab, you do not use any static or enum members, but in
the complete example, you do.
4 Open the Function & Object Browser and select .NET/CLR
Objects.
5 Highlight the System.IO namespace.
6 Highlight the FileInfo Type and the Constructor member.
Choose the Create Instance button. Take a look at the
generated formula template. Note that an output pin
named fileInfo is created by VEE, and it is set to a newly
created FileInfo object.
7 Choose Data Dialog Box File Name Selection. Wire the
File Name output pin to the fileName input pin of the Create
Instance formula box. Iconize the File Name Selection object.
8 Repeat step 4 and 5, highlight the FileInfo type. Highlight
the CreationTime property. Click the Create Get Formula
button. Since the CreateTime property returns a .NET
DateTiime object, you will use its ToString() method to
format and print out the creation time. So, append
.ToString()” after the formula generated by VEE. Be
sure to append it before the semicolon.
9 Wire the fileInfo output pin from the CreateInstance
formula box to the fileInfo input pin of fileInfo.CreationTime
formula box.
10 Add an Alphanumeric and wire it to the output pin of the
fileinfo.CreationTime formula box.