2 Replies - 393 Views - Last Post: 08 February 2013 - 07:07 AM Rate Topic: -----

#1 emerica243  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-February 13

Reading text file into array

Posted 05 February 2013 - 08:35 PM

So im new to coding and basically whatim trying to do is Read my text file AppList.txt and parse it based on seperators.

My current code is the following
Dim a As String = My.Computer.FileSystem.ReadAllText(Application.StartupPath & "\AppList.txt")
Dim B As String() = a.Split(vbNewLine)
ListBox1.Items.AddRange(B)/>



Which correctly loads the lines from AppList.txt into the ListBox like below.

AppName1
AppName2
AppName3


Now i edited the Applist.txt adding a path and executable names seperated by ; 's like shown below.


AppName1;\\server\appname\;AppNameSetup1.exe
AppName2;\\server\appname\;AppNameSetup2.exe
AppName3;\\server\appname\;AppNameSetup3.exe


And im trying to change the original code to include parsing all three sets of text between the ; 's seperately but am completely lost.

Something like this i imagine. But i know its obviously not right.

Dim a As String = My.Computer.FileSystem.ReadAllText(Application.StartupPath & "\AppList.txt")
        Dim B As String() = a.Split(";")
        For I = 0 To UBound(B)/> - 1 Step 3

        Next
        ListBox1.Items.AddRange(I)
        End  



Is This A Good Question/Topic? 0
  • +

Replies To: Reading text file into array

#2 emerica243  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-February 13

Re: Reading text file into array

Posted 05 February 2013 - 08:40 PM

Basically so when AppName1 is gighlighted int the listbox and i click a botton, i can call AppName1 \\server\appname\ and AppNameSetup1.exe all seperately from strings\variables
Was This Post Helpful? 0
  • +
  • -

#3 IronRazer  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 329
  • View blog
  • Posts: 996
  • Joined: 01-February 13

Re: Reading text file into array

Posted 08 February 2013 - 07:07 AM

Hi emerica243,
I am not sure what you mean by "call AppName1 \\server\appname\ and AppNameSetup1.exe all seperately from strings\variables" ? Are you trying to put all 3 strings back together so you can execute "AppNameSetupX.exe" ? Is there a reason that you are separating them into three separate strings ?

:unsure:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1