sarada

sarada

  • NA
  • 34
  • 0

hi

May 22 2009 9:22 AM

If File.Exists("F:\User.txt") Then

'Load user accounts

Dim sr As StreamReader = New StreamReader("F:\user.txt")

Dim sInput As String = ""

Dim ThisRow() As String

Dim sData() As String

Dim i As Integer

'//=Read all Data into sInput

Do While sr.Peek >= 0

sInput = sInput & sr.ReadLine & ControlChars.CrLf

Loop

ThisRow = Split(sInput, vbCrLf)

For i = 0 To UBound(ThisRow) - 1

sData = Split(ThisRow(i), ",")

Dim lsvi As New ListViewItem(sData, 2)

ListView1.Items.Add(lsvi)

Next

ListView1.Sort()

sr.Close()

End If

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//write

System.IO.TextWriter wr = System.IO.File.CreateText("F:\\text.ini");

for (int t = 0; t < listView1.Items.Count; t++)

{

string aline = listView1.Items[t].Text + ","; // comma delimited

for (int s = 1; s < listView1.Items[t].SubItems.Count; s++)

{

aline += listView1.Items[t].SubItems[s].Text + ",";// comma deliminted

}

aline = aline.Substring(0, aline.Length - 1); // remove trailing comma

wr.WriteLine(aline);

}

wr.Flush();

wr.Close();


Answers (1)