Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls
Reading data file into multiple listview controls Reading data file into multiple listview controls
Reading data file into multiple listview controls
Go Back  Xtreme Visual Basic Talk > > > Reading data file into multiple listview controls


Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2009, 10:53 AM
DavidTiger1 DavidTiger1 is offline
Newcomer
 
Join Date: Jan 2008
Posts: 1
Default Reading data file into multiple listview controls


Hello I am creating a program that consists of a tabcontrol with 5 tabs, within each tab a listview control.
I am looking for a way to read an external file and split the data that is read between the 5 listview boxes..


the data file is set out like:
Code:
XRG Power,58AFB4,4 Bytes,1062909572
XRG Drive,58AF98,4 Bytes,1
XRG Cylinders,58AFAC,4 Bytes,4
XRG Displacement,58AFA8,4 Bytes,1155596288
XRG Turbo,58AFA0,4 Bytes,12
XRG Turbo Pressure,58AFB04,4 Bytes,0
END XRG
XFG Drive,58995C,4 Bytes,2
XFG Power,589978,4 Bytes,0.83
XFG Displacement,58996C,4 Bytes,1298.392
XFG Cylinders,589970,4 Bytes,4
XFG Turbo,589964,4 Bytes,12
XFG Turbo Pressure,589974,4 Bytes,1
END XFG
FBM Drive,571C0C,4 Bytes,1
FBM Turbo,571C14,4 Bytes,12
FBM Turbo Pressure,571C24,4 Bytes,1
FBM Power,571C28,4 Bytes,0.6
END FBM
Cyl. min,5A4E92,4 Bytes,1
Cyl. max,5A4E93,4 Bytes,4
Disp. max,5A4E98,4 bytes,2000
Disp. min,5A4E94,4 Bytes,1000
END XRS
Cyl. min,5A4F0A,4 bytes,1
Cyl. max,5A4F0B,4 Bytes,1
Disp. min,5A4F0C,4 Bytes,1000
Disp. max,5A4F4C,4 Bytes,8000
END FBS
Where after each "END XXX" is the data for the next listviewbox

I am able to read the first set of data, into the first listview box but Im looking for a little assistance to read the rest of the data into the other listview boxes.

The following code is used to read the file "data.LFS" and split the data up into the columns and rows of the listview control.

Code:
        Dim Name As String
        Dim Address As String
        Dim type As String
        Dim value As String
        Try
            Dim sr As IO.StreamReader
            'declaration of filestream to open file
            Dim fs As IO.FileStream
            'clearing listbox data toavoid confusion
            'filestream object to open and read file
            fs = New IO.FileStream((Application.StartupPath & "/data.LFS"), IO.FileMode.OpenOrCreate)
            'stream reader object to read streamed input
            sr = New IO.StreamReader(fs)
            Dim itm As Object
            'reading line by line
            itm = sr.ReadLine
            While Not itm = Nothing
                Dim split As String() = itm.Split(New [Char]() {","})
                Name = split(0)
                Address = split(1)
                type = split(2)
                value = split(3)

                lstxrg.Items.Add(Name)
                lstxrg.Items(lstxrg.Items.Count - 1).SubItems.Add(Address)
                lstxrg.Items(lstxrg.Items.Count - 1).SubItems.Add(type)
                lstxrg.Items(lstxrg.Items.Count - 1).SubItems.Add(value)
                itm = sr.ReadLine
            End While
            'close stream reader and filestrema object
            sr.Close()
            fs.Close()
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message, "Load Tool Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
Thanks to everyone who helps
-Tiger
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls Reading data file into multiple listview controls
Reading data file into multiple listview controls
Reading data file into multiple listview controls
 
Reading data file into multiple listview controls
Reading data file into multiple listview controls
 
-->