OK i have an array of 10 elements and I want to color the 5th element with a different color than the default color , is that possible ?


Thanks

Recommended Answers

All 6 Replies

An element?
Which element, chemical?
Be more specificic with your question please.

an index of an array
EX: if i the array size 10 thats mean we have 10 indexes so I want to color the index number 5 only and the rest 9 indexes will remain uncolored

Thanks

An array is a variable in memory you can not color that.
But I guess you want to color text you see on a screen?
Lets say 10 numbers from an array and you want to color number 5?

An array is a variable in memory you can not color that.
But I guess you want to color text you see on a screen?
Lets say 10 numbers from an array and you want to color number 5?

yes when I output the array to the textbox I want number 5 to be colored

Why didn't you asked that question in the first place?
I'm affraid it can't be done in a normal textbox.
But it can certainly be done in a RichTextBox.
I have not tried it but this should work:
MyRichTextBox.Select(6,1);//select char 6 from my text
MyRichTextBox.SelectionColor=Color.Red;//color this red

Open your help menu and choose search, type RichTextBox for more information

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.