Dim fileResume As Boolean
If System.IO.File.Exists("users.csv") Then
Dim di As New FileInfo("users.csv")
If di.Length <> 0 Then
' Resume File
fileResume = True
Dim Form2 As New Form2
'Dim csvFile As String
'Dim csvBank As String
If Form2.ShowDialog() = DialogResult.OK Then
csvFile = Form2.listItem
csvBank = Form2.newBank
frm3File = Form2.Frm3File
frm3User = Form2.Frm3User
End If
If csvBank = "New Project" Then
fileResume = False
MessageBox.Show(csvFile, "filename")
Dim userFile As New IO.StreamWriter("users.csv", True)
Dim m_today As Date
m_today = Date.Today
userFile.Write(m_today & "," & frm3User & "," & frm3File & ".csv")
userFile.Close()
csvFile = frm3File
Else
fileResume = True
Dim commaseparator As Char() = ","
Dim srd As StreamReader = Nothing
Try
srd = New StreamReader(csvFile)
line = srd.ReadLine()
While Not (line Is Nothing)
fields = line.Split(commaseparator)
If fields.Length <> 3 Then
GoTo ContinueWhile4
End If
Dim qe As QuestionElement
For Each qe In gt
If qe.Id = Int32.Parse(fields(1)) Then
qe.Answered = True
End If
Next qe
ContinueWhile4:
line = srd.ReadLine()
End While
Catch
Finally
If Not (Nothing Is srd) Then
CType(srd, IDisposable).Dispose()
End If
End Try
End If
End If
Else
'Dim m_fileUsers As New IO.StreamWriter("users.csv")
Dim m_today As Date
m_today = Date.Today
Dim myForm3 As New Form3
If myForm3.ShowDialog() = DialogResult.OK Then
csvFile = myForm3.MyFilename
End If
csvFile = csvFile & ".csv"
Dim m_fileUsers As New IO.StreamWriter("users.csv")
m_fileUsers.Write(m_today & "," & myForm3.MyUsername & "," & myForm3.MyFilename & ".csv")
m_fileUsers.Close()
End If