Welcome to Dream.In.Code
Become a VB Expert!

Join 137,233 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,798 people online right now. Registration is fast and FREE... Join Now!




Import Data from a text file

 
Reply to this topicStart new topic

Import Data from a text file

brottmayer
16 Mar, 2007 - 07:31 AM
Post #1

D.I.C Head
**

Joined: 21 Jan, 2007
Posts: 67


My Contributions
How do you select a specific line from an open file and input those specific into a designated textbox?

When I open up a file with the opendialog() and then select the file that I want to import(or to pull data from). This is the text file setup that I am trying to get the information from:

--------------------------------------------------------
ASSIGN.RSM A 6:00:00 "Initialize Times"
ASSIGN.RSM B 6:10:59
ASSIGN.RSM C 6:02:02
--------------------------------------------------------

Now I want to input the first line if they select A, which designates the first line of the text file and then from there to input the 6 in textbox1.text and 00 into textbox2.text and 00 into textbox3.text. Now if they select B, then it'll pull the information from line 2 and put the 6 in textbox1.text and the 10 in textbox2.text and etc. How would I go about doing that? Thanks.
User is offlineProfile CardPM
+Quote Post

tody4me
RE: Import Data From A Text File
16 Mar, 2007 - 10:18 AM
Post #2

Only Jenny Craig makes thin clients...
Group Icon

Joined: 12 Apr, 2006
Posts: 1,279



Thanked: 3 times
Dream Kudos: 100
My Contributions
use the open syntax from msdn (open <file number> <type> <file path>, etc), then read the data into a collection (using A, B, C, etc as the key) and then when the key is selected / typed in to the textbox, bring in the value that is correspondent to the collection key. Example - collection contains 3 keys, A, B, and C, and A contains the first line, B contains the second line of data, and C contains the third line. When the user types in A, retrieve the value for A by using the collection.items("A") syntax.
User is offlineProfile CardPM
+Quote Post

brottmayer
RE: Import Data From A Text File
18 Mar, 2007 - 11:54 AM
Post #3

D.I.C Head
**

Joined: 21 Jan, 2007
Posts: 67


My Contributions
QUOTE(tody4me @ 16 Mar, 2007 - 11:18 AM) *

use the open syntax from msdn (open <file number> <type> <file path>, etc), then read the data into a collection (using A, B, C, etc as the key) and then when the key is selected / typed in to the textbox, bring in the value that is correspondent to the collection key. Example - collection contains 3 keys, A, B, and C, and A contains the first line, B contains the second line of data, and C contains the third line. When the user types in A, retrieve the value for A by using the collection.items("A") syntax.



tody4me, could you please direct me to the article that MSDN has describing what you are saying? I've looked "everywhere." Thanks.

brottmayer
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 03:35PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month