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
As Ak
NA
65
7.6k
Display data from txt file to richtextbox
Sep 30 2020 1:23 AM
I want to be able to display data from .txt file up into a richtextbox.
This is the code I have at the moment:
private
void
getDetails()
{
string
Path = $@
"Z:\IT\Shares\PC\DA-0123\SD\SDD\DataFile.txt"
;
if
(File.Exists(Path))
{
var data = File
.ReadAllLines(Path)
.Select(x => x.Split(
'='
))
.Where(x => x.Length > 1)
.ToDictionary(x => x[0].Trim(), x => x[1]);
using
(StreamWriter tw = File.AppendText($@
"Z:\IT\Shares\PC\DA-0123\SD\Files\SysLog.txt"
))
{
//I want this data being displayed in richTextBox
tw.WriteLine(
"Details..\n"
);
tw.WriteLine(
"Name: {0}"
, data[
"Name"
]);
tw.WriteLine(
"Emp ID: {0}"
, data[
"Emp ID"
]);
tw.WriteLine(
"---------------------------------------------\n"
);
}
}
}
Reply
Answers (
1
)
Chorme type tabs in C# windows application.
Argument Null Ecxeption