extract/convert text file to table
hi,
i'm totally a newbie..
i have to extract/convert a text file and show it in table form in VB.
basically, when i click a button,an open box appears ( we use the common dialog right? ), choose a textfile(file.txt) and automatically the data in the textfile will show in a table form..
i'v search for examples..but no luck..
help..i'm have no idea how to do... :( TQ..
[404 byte] By [
jer] at [2007-11-11 7:52:17]

# 2 Re: extract/convert text file to table
I'm assuming this is a class assignment, so I'll give you hints but not code.
I would use an MSFlexGrid control to display the text file. Use VB's Line Input function to read the file one line at a time. If the columns of data in the text file are separated by something other than tab characters, use the Replace function to replace the separators with tab characters (vbTab). Then use the FlexGrid's AddItem method to insert each line into the grid.
You can find more information on the MSFlexGrid control and the Line Input and Replace functions in VB's online help, or on the Web. Post a followup message here if you get stuck. Good luck! :-)
# 3 Re: extract/convert text file to table
jer,
It's not that we (meaning PHIL) don't want to help you, but good programming comes from a LOT of trial-and-error learning. It's when we hit a brick wall, spend many hours trying to find the answer, and then start beating our heads against that wall that we learn the most. It's kinda like learning to appreciate the things we have when we have to buy them with the money WE earned.
Phil is doing you a service by not giving you code. We (myself included this time) WILL help you, once you get started. We'll tell you if you're headed in the right direction and might even show you where your code is funky when it's NOT headed in the right direction.
You get started on it and post what you have and we'll help.
There!
Mom....I mean Laurel
Laurel at 2007-11-11 17:28:19 >
