C
chauc3r
I'm having problems writing to a text file. Basically it refuses to
write anything. The file is created. At the appropiate times it goes
into the correct if statements (I have verified this using msgboxes).
Any idea why it wouldnt be writing anything?
Do Until (objFacilitySht.Cells(row, cboAPName.Text).Value = "")
Dim fsStream As New FileStream(txtSaveto.Text & "\" &
objFacilitySht.Cells(row, cboAPName.Text).Value & ".txt",
FileMode.Create, FileAccess.Write)
Dim swWriter As New StreamWriter(fsStream)
' Start Writing Config files
Try
' Do until the end of the config sheet
counter = 1
Do Until (objConfigSht.Cells(counter, 1).Value = "")
If (InStr(objConfigSht.Cells(counter, 1).Value, "###")) Then
pound = objConfigSht.Cells(counter, 1).value.replace("#", "")
If pound = "1" Then
swWriter.WriteLine("!Revision " & Rev_date)
End If
Else
swWriter.WriteLine(objConfigSht.Cells(counter, 1).Value)
End If
counter += 1
Loop
swWriter.Close()
Catch ex As IOException
MsgBox(ex.Message)
End Try
row += 1
Loop
write anything. The file is created. At the appropiate times it goes
into the correct if statements (I have verified this using msgboxes).
Any idea why it wouldnt be writing anything?
Do Until (objFacilitySht.Cells(row, cboAPName.Text).Value = "")
Dim fsStream As New FileStream(txtSaveto.Text & "\" &
objFacilitySht.Cells(row, cboAPName.Text).Value & ".txt",
FileMode.Create, FileAccess.Write)
Dim swWriter As New StreamWriter(fsStream)
' Start Writing Config files
Try
' Do until the end of the config sheet
counter = 1
Do Until (objConfigSht.Cells(counter, 1).Value = "")
If (InStr(objConfigSht.Cells(counter, 1).Value, "###")) Then
pound = objConfigSht.Cells(counter, 1).value.replace("#", "")
If pound = "1" Then
swWriter.WriteLine("!Revision " & Rev_date)
End If
Else
swWriter.WriteLine(objConfigSht.Cells(counter, 1).Value)
End If
counter += 1
Loop
swWriter.Close()
Catch ex As IOException
MsgBox(ex.Message)
End Try
row += 1
Loop