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
Abdu Abdul
1.3k
409
14.9k
Change the color of text in richtextbox uisng string builder
Mar 14 2021 10:56 PM
Please am looking for away to change the color of text retrieved from database(sql server) using string builder, I have tried several methods but did not work, can anyone help me out.
SqlCommand cmd=
new
SqlCommand(
"SELECT * FROM [Box] where item=@item"
, connect);
cmd.Parameters.AddWithValue(
"@item"
, item.Text);
StringBuilder resp =
new
StringBuilder();
SqlDataReader cmd_reader = cmd.ExecuteReader();
item.Text =
""
;
while
(cmd_reader.Read())
{
respond.SelectionColor = Color.Red;
resp.Append(cmd_reader.GetString(6)).Append(Environment.NewLine);
respond.SelectionColor = Color.Green;
resp.Append(cmd_reader.GetString(7)).Append(Environment.NewLine);
}
item.Text = resp.ToString();
is retrieving fine from the database but I want to change the colors of each line..
Reply
Answers (
2
)
for each if break
How to display Paytm dynamic QR Code on Paytm QR device