Use word SET in invoke code

code
studio
invoke

#1

I am trying to read a file which has 4,000 line more o less however I dont how to declare the variable which will start reading line by line. I have written the word set but it looks that invoke code doesnt recognize this word, so I declare my variable as object but when I run my project it is shows a error.

I dont use the activity read text file because it doesn’t do anything I think that it is because the file is a little large


#2

You should use plain .Net classes instead of VBA COM objects.
Something like this:

Using sr As StreamReader = File.OpenText(“C:\Users\adrian\Desktop\a.txt”)
Do While sr.Peek() >= 0
Console.WriteLine(sr.ReadLine())
Loop
End Using

Adrian.


#3

Hi @adrian

What is stream reader


#4

it is a .Net class which one can use to work with text files
see:
https://msdn.microsoft.com/en-us/library/system.io.streamreader(v=vs.110).aspx

Adrian.