I have a datagridview and few testbox. User types in the details into the text box and when pressed enter it adds to the datagridview. Now the question is user will be allowed to save the rows into a text file but it in not saving in a proper format ie i am getting as:
Quantity Name Rate
--------------------
12 wers 30
2323 ertd 40
there is no correct space between values. But i want it to save like this
This is the code i am currently using
Any ideas in vb.net ??? plz help me out
Quantity Name Rate
--------------------
12 wers 30
2323 ertd 40
there is no correct space between values. But i want it to save like this
VB.NET:
Quantity Name Rate
-------------------------
12 wers 30
2323 ertd 40
This is the code i am currently using
VB.NET:
strTemp = "DC" & id
Using theWriter As New System.IO.StreamWriter("c:\" & strTemp & ".txt")
theWriter.WriteLine("--------------Billing Software--------------")
theWriter.WriteLine()
theWriter.WriteLine("Billing Date:" & System.DateTime.Now.Date & " Time: " & System.DateTime.Now.Hour & ":" & System.DateTime.Now.Minute)
theWriter.WriteLine()
theWriter.WriteLine("---------------------------------------------")
theWriter.WriteLine()
theWriter.WriteLine("Quantity Item/Sub Code Description Rate")
theWriter.WriteLine()
theWriter.WriteLine("---------------------------------------------")
Dim space As String = " "
For Each currentrow As DataGridViewRow In Me.DataGridView1.Rows
' The Cells are the Columns
For Each currentcolumn As DataGridViewCell In currentrow.Cells
theWriter.Write(currentcolumn.Value & " ")
Next
theWriter.WriteLine()
Next
theWriter.WriteLine("---------------------------------------------")
theWriter.Close()
End Using