fileinfo to string??
-
I'm getting a file from a listbox that is fileinfo. I'm going to do some reading and writing based on the data in the selected file. I can only find examples of streamreader that use file name as a string. How do I convert the fileinfo to string? Thanks
silver-gray
-
I'm getting a file from a listbox that is fileinfo. I'm going to do some reading and writing based on the data in the selected file. I can only find examples of streamreader that use file name as a string. How do I convert the fileinfo to string? Thanks
silver-gray
Every .NET class has a tostring method. What do you mean by FileInfo ? Surely there's a sring there, what's the listbox showing ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
I'm getting a file from a listbox that is fileinfo. I'm going to do some reading and writing based on the data in the selected file. I can only find examples of streamreader that use file name as a string. How do I convert the fileinfo to string? Thanks
silver-gray
You should look into the FileInfo.OpenRead and FileInfo.OpenWrite methods. This will return a FileStream that you can use in the constructor of a StreamReader. Example Imports System.IO Dim fi As FileInfo 'get object from list box Using fs As FileStream = fi.OpenRead() 'use fi.OpenWrite() for a writeable stream Using sr As New StreamReader(fs) 'read or write here End Using End Using
-
I'm getting a file from a listbox that is fileinfo. I'm going to do some reading and writing based on the data in the selected file. I can only find examples of streamreader that use file name as a string. How do I convert the fileinfo to string? Thanks
silver-gray
-
I'm getting a file from a listbox that is fileinfo. I'm going to do some reading and writing based on the data in the selected file. I can only find examples of streamreader that use file name as a string. How do I convert the fileinfo to string? Thanks
silver-gray