Hi All
I have a small problem with this code. I am adding information to my listview from multiple textboxes. As I add the info I automatically update a text file with the code shown below. The problem I have is
When I add my first row the code will not write the data back to the text file, however if I add a second row the code is quite happy to write both rows of data back to the text file. I cannot for the life of me see what is wrong.
CODE
'Write tool info to text file
Dim outputstream As StreamWriter = File.CreateText("C:\MFSProFiles\" & CObj(PartNoTextBox.Text) & ".tme")
Dim s As Short
Dim newstr(27) As String
Dim I As Integer
Dim Toolnum As String
Dim process As String
Dim Description As String
Dim Feed As String
Dim Speed As String
Dim Time As String
Dim Grade As String
Dim tooldia As String
Dim numteeth As String
Dim FPT As String
Dim CSS As String
Dim Cuttype1 As String
Dim Cutdescription1 As String
Dim Cutlength1 As String
Dim Numcuts1 As String
Dim rapidlength1 As String
Dim totalrapid As String
Dim fourthindex1 As String
Dim Numfourthindexes As String
Dim fifthindex As String
Dim Numfifthindexes1 As String
Dim Startclearance As String
Dim endclearance1 As String
Dim drawingref1 As String
Dim rapidtime As String
Dim fourthtime As String
Dim fifthtime As String
Dim totaltooltime1 As String
Dim ItemCount As Integer
ItemCount = Me.ListView1.Items.Count
For I = 0 To ItemCount - 1
For s = 0 To 27
newstr(s) = ListView1.Items.Item(I).SubItems(s).Text
Next
Toolnum = newstr(0)
process = newstr(1)
Description = newstr(2)
Feed = newstr(3)
Speed = newstr(4)
Time = newstr(5)
Grade = newstr(6)
tooldia = newstr(7)
numteeth = newstr(8)
FPT = newstr(9)
CSS = newstr(10)
Cuttype1 = newstr(11)
Cutdescription1 = newstr(12)
Cutlength1 = newstr(13)
Numcuts1 = newstr(14)
rapidlength1 = newstr(15)
totalrapid = newstr(16)
fourthindex1 = newstr(17)
Numfourthindexes = newstr(18)
fifthindex = newstr(19)
Numfifthindexes1 = newstr(20)
Startclearance = newstr(21)
endclearance1 = newstr(22)
drawingref1 = newstr(23)
rapidtime = newstr(24)
fourthtime = newstr(25)
fifthtime = newstr(26)
totaltooltime1 = newstr(27)
outputstream.WriteLine(Toolnum & "," & process & "," & Description _
& "," & Feed & "," & Speed & "," & Time & "," & Grade & "," & tooldia & "," _
& numteeth & "," & FPT & "," & CSS & "," & Cuttype1 & "," _
& Cutdescription1 & "," & Cutlength1 & "," & Numcuts1 & "," & rapidlength1 _
& "," & totalrapid & "," & fourthindex1 & "," & Numfourthindexes & "," _
& fifthindex & "," & Numfifthindexes1 & "," & Startclearance & "," _
& endclearance1 & "," & drawingref1 & "," & rapidtime & "," & fourthtime & "," & fifthtime _
& "," & totaltooltime1)
Next I
outputstream.Close()
Can anybody see what the problem is
Thanks in advance