I've run into a couple of errors within my program which reads a text file. When a user clicks a button to read the textfile and an exception is thrown, i have it displayed as a string in a message box, but an additional message box related to runtime error 52 'bad filename or number' has shown up and continues to pop up, even after clicking ok. I am currently working on the error itself in the textfile, but until I can work around all of the variables with reading this file, I was wondering if there is anything I can do to either prevent the runtime error box from popping up or figure out why it's popping up so many times. The really weird thing is sometimes after clicking ok on the initial message box displaying the error string, it won't pop up and other times it does, repeatedly.
Jump to Post
Can u show us ur code so that we can find out where u are going wrong....
Jump to Post
Reading and writing from/to a text file is a VERY simple procces;
You need to define a stream reader/writer
Dim sr As New StreamReader("C:/Users/MyUser/Desktop/file.txt") Do While sr.Peek <> -1 Dim curLine as String = sr.ReadLine 'curLine now holds an entire line from the text file, from crlf …
All 6 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.