Hi guys,
I have the following coding and i would like to save it using save file dialog. Any idea?
Thnx.
Dim numCols As Integer = dgvExp.ColumnCount
Dim numRows As Integer = dgvExp.RowCount - 1
Dim strDestinationFile As String = "c:\username.txt"
Dim tw As TextWriter = New StreamWriter(strDestinationFile)
'writing the header
For count As Integer = 0 To numCols - 1
tw.Write(dgvExp.Columns(count).HeaderText)
If (count <> numCols - 1) Then
tw.Write(", ")
End If
Next
tw.WriteLine()
For count As Integer = 0 To numRows - 1
For count2 As Integer = 0 To numCols - 1
tw.Write(dgvExp.Rows(count).Cells(count2).Value)
If (count2 <> numCols) Then
tw.Write(", ")
End If
Next
tw.WriteLine()
Next
tw.Close()
End Sub