I've got a requirement to change text backcolor in RTB. RTB is getting created in a loop for number of messages from DB.
I implemented a logic to achieve it but feel logic as simple.
So could you be able to give idea to implement same or mine is fine?
foreach (DataSet.NoteRow note in _ds.Note)
private void CreateNotes(string note)
//txt : Rich Text Box dynamically created for each note
//test : Selected text in 'note'
int index = txt.Text.ToUpper().IndexOf(test.ToUpper());
txt.SelectionFont = new Font(txt.Font.Name, txt.Font.Size, txt.Font.Style^ FontStyle.Bold);
//x global variable initialised as 1
if(x % 2 == 1)
txt.SelectionBackColor = System.Drawing.Color.Gray;
If Notes has 5 messages, then alternative message should have gray backcolor.