TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vuk Stanojevic
1.6k
140
44.8k
c# add carriage return and line feed
Nov 3 2020 10:45 AM
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 =
""
;
}
Reply
Answers (
7
)
i have images in resources how can i retrieve it
Share textbox value from one form to other in winforms