Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27333

listbox integer increment HELP PLEASE

$
0
0
I'm writing a program that will list a table in the list box for example

Time quantity passed failed comment
___________________________________________________________________________
7:00-8:00 25 23 2 none
8:00-9:00 30 25 5 none


i have the program to add additional times as needed. The program is reading and writing from a text file. Now the problem is i have a button where when its clicked it increases the quantity and same for passed and failed but rather then increasing current time's quantity it will increase both s or all the quantities of times listed how do i get it to just increase the quantity of just current time. her is my code for that button.

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

Dim sriv As IO.StreamReader = IO.File.OpenText("C:\Users\Mike\Desktop\Production AP\PRODUCTION_DATA_APP\PRODUCTION_DATA_APP\My Project\data.txt")
'must creat a temp file becaue program scans from top to bottom and never goes back
Dim swdel As IO.StreamWriter = IO.File.CreateText("Tempinv.txt")


Dim time, quantity, failed, comment As String





Do Until sriv.EndOfStream
time = CStr(sriv.ReadLine)
quantity = CStr(sriv.ReadLine)
passed = CDbl(sriv.ReadLine)
failed = CStr(sriv.ReadLine)
comment = CStr(sriv.ReadLine)


If passed >= 0 Then
swdel.WriteLine(time)
swdel.WriteLine(quantity)
swdel.WriteLine(passed+1)
swdel.WriteLine(failed)
swdel.WriteLine(comment)

End If

Loop



'must close both temp and our file
swdel.Close()
sriv.Close()
'delete old file and put new one instead
IO.File.Delete("C:\Users\Mike\Desktop\Production AP\PRODUCTION_DATA_APP\PRODUCTION_DATA_APP\My Project\data.txt")
IO.File.Move("tempinv.txt", "C:\Users\Mike\Desktop\Production AP\PRODUCTION_DATA_APP\PRODUCTION_DATA_APP\My Project\data.txt")
'outputs the time being deleted



End Sub

Viewing all articles
Browse latest Browse all 27333

Trending Articles