Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

Export or save delimited text file by quotation from datagrid.

$
0
0
Hi
I have a text file delimited by quotation, that position in a datagrid which I make some changes but then I need to export it or save it to a folder.
In WF do so without any inconvenience.

Also take advantage of the kindness of experts to see how I can agree to paint a column value of a row.
For example, if column A has in his cell a value of 01 is red, if you have 02 yellow value.

should be stored as follows:
'01 '' Manuel jury ''1967' '44 years'

I use Windows Forms WPF

If File.Exists("D:\m2\test.DAT") Then
File.Delete("D:\m2\test.DAT")
End If

Const Dat As String = ("D:\m2\test.DAT")

Using f As New IO.StreamWriter(Dat, True)

Dim col As String = ""

Dim row As String = ""
Dim i As Integer = 0
For Each r As DataGridViewRow In DataGridView1.Rows
For Each c As DataGridViewColumn In DataGridView1.Columns
row = row & "'" & Convert.ToString(r.Cells(c.HeaderText).Value) & "' "
Next
If i < DataGridView1.Rows.Count - 1 Then row &= Environment.NewLine
Next

f.Write(row)
End Using



Cheers

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>