Hi
On above line i am getting error
Error - The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)
Thanks
Hi
On above line i am getting error
Error - The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Naimish MakwanaPosted Apr 14, 2023, 9:47 AM
This error message suggests that the compiler is unable to locate the
Microsoft.VisualBasic.FileIOnamespace, which is required for the code you are trying to run.To resolve this error, you can try adding a reference to the
Microsoft.VisualBasicassembly in your project. Here are the steps to do this in Visual Studio:Once you have added the reference, you should be able to use the
Microsoft.VisualBasic.FileIOnamespace in your code without any errors.Tuhin PaulPosted Apr 16, 2023, 1:16 AM
an example in Visual Basic that reads the contents of a text file using the
System.IOnamespaceThis code first imports the
System.IOnamespace, which provides classes for reading and writing to files. It then defines aMainmethod that reads the contents of a text file located at"C:\example\file.txt". The contents of the file are read using aStreamReader, which reads text from a stream (in this case, a file). TheUsingstatement is used to automatically close theStreamReaderobject once it is no longer needed. If an error occurs while reading the file, a message is displayed to the console.Tuhin PaulPosted Apr 16, 2023, 1:14 AM
sample code that uses the File class from the System.IO namespace to perform file operations instead of the FileIO class from the Microsoft.VisualBasic namespace
This code reads the contents of a file located at C:\example.txt using the File.ReadAllText method, and then writes new text to the file using the File.WriteAllText method. It does not use the FileIO class from the Microsoft.VisualBasic namespace.