Support Forums
[NEED HELP] how to read a text file and import to listview vb.net - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [NEED HELP] how to read a text file and import to listview vb.net (/showthread.php?tid=25128)



[NEED HELP] how to read a text file and import to listview vb.net - w00pz - 02-12-2012

Hello guys at SupportForums.net
I am looking for a way to read a text file ( Prefferably a text file inside the program that will be saved each time the program is closed. ) and import it to a listview.

And please do not spoon feed me, I want to learn something from this.
Thanks in advanced.



RE: [NEED HELP] how to read a text file and import to listview vb.net - AceInfinity - 02-12-2012

"A text file inside the program" - You're referring to a resoruce? And saved where? As an updated resource? Or as a file inside Windows Explorer on the NTFS filesystem? You need to be more specific.

How much data is this "text file inside the program" going to hold? Is it going to be large amounts of data or small amounts, because you could use string resources, although I would ask why you'd want to embed this data as it only makes the base executable a larger filesize for no reason.


RE: [NEED HELP] how to read a text file and import to listview vb.net - w00pz - 02-13-2012

(02-12-2012, 08:13 PM)AceInfinity Wrote: "A text file inside the program" - You're referring to a resoruce? And saved where? As an updated resource? Or as a file inside Windows Explorer on the NTFS filesystem? You need to be more specific.

How much data is this "text file inside the program" going to hold? Is it going to be large amounts of data or small amounts, because you could use string resources, although I would ask why you'd want to embed this data as it only makes the base executable a larger filesize for no reason.
Yes I want the text file to be inside the resources, and it will have links in it.
I would also need to know how to write to the text file.

Thanks a lot for your time.



RE: [NEED HELP] how to read a text file and import to listview vb.net - AceInfinity - 02-13-2012

Why does it need to be in resources? And if that's the case, you're better off with a string table.


RE: [NEED HELP] how to read a text file and import to listview vb.net - w00pz - 02-13-2012

(02-13-2012, 05:10 AM)AceInfinity Wrote: Why does it need to be in resources? And if that's the case, you're better off with a string table.

It doesn't need to, but I think it will look unprofessional if it's just lying around on the desktop.


RE: [NEED HELP] how to read a text file and import to listview vb.net - AceInfinity - 02-13-2012

(02-13-2012, 06:11 AM)w00pz Wrote: It doesn't need to, but I think it will look unprofessional if it's just lying around on the desktop.

It's not unprofessional, but it doesn't have to lie around on the desktop either Smile You could have it in your program files directory, a temp directory, anywhere. You could have it created in the directory with your application, so that it always looks for that location. And if it doesn't exist, then it re-creates it starting over with the data it beholds. Lots of different ways you can go about something like this, but an external file in my opinion would be much more manageable.


RE: [NEED HELP] how to read a text file and import to listview vb.net - w00pz - 02-13-2012

(02-13-2012, 06:32 AM)AceInfinity Wrote: It's not unprofessional, but it doesn't have to lie around on the desktop either Smile You could have it in your program files directory, a temp directory, anywhere. You could have it created in the directory with your application, so that it always looks for that location. And if it doesn't exist, then it re-creates it starting over with the data it beholds. Lots of different ways you can go about something like this, but an external file in my opinion would be much more manageable.
Well I have no idea how to do all this, but if you wanna learn me how to do it then that would be extremely cool. Smile


RE: [NEED HELP] how to read a text file and import to listview vb.net - AceInfinity - 02-13-2012

You mention this:
Quote:And please do not spoon feed me, I want to learn something from this.

So I won't do that, but I'll give you some inspiration.

http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx

http://msdn.microsoft.com/en-us/library/system.environment.getfolderpath.aspx

http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.listviewitemcollection.addrange.aspx