pasensyoso_manigbas
Well-known member
- Joined
- May 19, 2006
- Messages
- 64
- Programming Experience
- Beginner
hello pipz... i need help again..
well what im trying to do is i want to save a multiple lines of records in a file using a loop.. but it seems like infinite it goes over and over from the start without stoping...
take a look at this:
any help is appreciated.. thanx...
well what im trying to do is i want to save a multiple lines of records in a file using a loop.. but it seems like infinite it goes over and over from the start without stoping...
take a look at this:
VB.NET:
[SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE][SIZE=2] str_reader.Peek() > -1
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] l_v [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ListViewItem
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] _split() [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = str_reader.ReadLine.Split(";".ToCharArray)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] x, y [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2] x = 0 [/SIZE][SIZE=2][COLOR=#0000ff]To[/COLOR][/SIZE][SIZE=2] lst.Items.Count - 1
[/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] (lst.Items.Item(x).Text.Equals(_split(1))) [/SIZE][SIZE=2][COLOR=#0000ff]And[/COLOR][/SIZE][SIZE=2] (lst.Items.Item(x).SubItems(1).Text.Equals(_split(2))) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#008000] 'lets put some graphics to listview
[/COLOR][/SIZE][SIZE=2] l_v.ImageIndex = 0
[/SIZE][SIZE=2][COLOR=#008000]'displays the contents of the file
[/COLOR][/SIZE][SIZE=2]l_v.Text = _split(0)
l_v.SubItems.Add(_split(1))
l_v.SubItems.Add(_split(2))
logview.Items.Add(l_v)
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] (lst.Items.Item(x).Text <> (_split(1)) [/SIZE][SIZE=2][COLOR=#0000ff]And[/COLOR][/SIZE][SIZE=2] (lst.Items.Item(x).SubItems(1).Text <> (_split(2)))) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] connection.State = ConnectionState.Open [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2] connection.Close()
connection.Open()
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sql$ = ("Insert into UAAs values ('" & _split(0) & "','" & _split(1) & "','" & _split(2) & "'," & LogOpener.FileName.Substring(17, 1) & ")")
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] cmd [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OleDbCommand = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbCommand(sql, connection)
cmd.ExecuteNonQuery()
connection.Close()
[COLOR=blue]End if[/COLOR]
[COLOR=blue]End if[/COLOR][/SIZE]
any help is appreciated.. thanx...
Last edited by a moderator: