Hi everyone,
i'm exporting datagridview to txt file.
first 2 lines of txt are defined in advanced.
other lines of txt should be exported from datagridview.
I manage to do it, but for each line which will be written in txt i need to add 0x0D carriage return and 0x0A line feed.
Can you help me how to add carriage and line feed.
My code is bellow.
Thank you.
- tw.WriteLine(cban + cname + ccity + date + blanko + mbank + nula).ToString();// on the end of this line i have to add carriage return(0x0D), and Line feed (0x0A)
- tw.WriteLine(cban + cname + ccity + totamount.ToString() + totalxml.ToString() + blanko2 + type);// on the end of this line i have to add carriage return(0x0D), and Line feed (0x0A)
- for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
- {
- for (int j = 0; j <= dataGridView1.Columns.Count - 1; j++)
- {
- sLine = sLine + dataGridView1.Rows[i].Cells[j].Value;
- }
- tw.WriteLine(sLine); //also for each line written from datagridview i have to add on the end of each line carriage return(0x0D), and Line feed (0x0A)
- sLine = "";
- }
Sachin SinghPosted Nov 6, 2020, 8:33 AM
Encoding ascii = Encoding.ASCII;Ashutosh GuptaPosted Nov 7, 2020, 7:19 AM
Mario ScheerenPosted Nov 6, 2020, 8:16 AM
Vuk StanojevicPosted Nov 6, 2020, 7:55 AM
Sachin SinghPosted Nov 5, 2020, 10:12 PM
Ben ThompsonPosted Nov 5, 2020, 3:34 PM
Mario ScheerenPosted Nov 3, 2020, 11:06 AM