Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If dataGridView1.RowCount > 0 Then Dim RowcCount As [String] = "" Dim Startuppath As String = Application.StartupPath + "/" 'File Extension as your requirement .dat or .txt Dim Destinationpath As String = Startuppath & "" & DateTime.Now.ToString("dd-MMM-yyy") & ".txt" Using Streamwrite As StreamWriter = File.CreateText(Destinationpath) For i As Integer = 0 To dataGridView1.Rows.Count - 1 RowcCount = "" For j As Integer = 0 To dataGridView1.Columns.Count - 1 If RowcCount.Length > 0 Then RowcCount = RowcCount & "," & DataGridView1.Rows(i).Cells(j).Value.ToString() Else RowcCount = dataGridView1.Rows(i).Cells(j).Value.ToString() End If Next Streamwrite.WriteLine(RowcCount) Next Streamwrite.WriteLine(Streamwrite.NewLine) Streamwrite.Close() MessageBox.Show("File Created Successfully") End Using Else End If End Sub
RowcCount = dataGridView1.Rows(i).Cells(j).Value.ToString()
dataGridView1.Rows(i).Cells(j).Value.ToString()
dataGridView1.Rows(i).Cells(j).Value
Convert.ToString();
Convert.ToString()
For i As Integer = 0 To dataGridView1.Rows.Count - 1
For i As Integer = 0 To dataGridView1.Rows.Count - 2
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)