scotty134

NA HMI Read a file from USB

4 posts in this topic

Hello,

I have an idea to read a text file (txt,xml,csv, etc.) from USB on NA HMI. I did small research over internet and NA terminal manual, but was not able to find any information how can I read a file using VB script on NA HMI panel. Is it anybody tried vb scripting in way to read a file or data from USB stick connected to HMI panel?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

I believe I have found the solution. System.IO.StreamReader or System.IO.File.AppendText

Share this post


Link to post
Share on other sites

with StreamReader , you read but with AppendText you can create and  add a line in a txt file .

Share this post


Link to post
Share on other sites

Make a text box on your screen and a button to call the ReadTXT subroutine. Add this to your page code:

Dim FileReader As System.IO.StreamReader

Public Sub ReadTXT
    
        FileReader = System.IO.File.OpenText( "\USBDisk\txtdoc.txt")
        TextBox0.text=FileReader.ReadToEnd
        FileReader.close
End Sub   

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now