Hello, i have code where i call function on textchanged in richtextbox, but here is one problem, when i input first character, it works as i expected, but when i input second characted, then full text is green, dont know why. How to fix this please?
1 2 3 4 5 6 7 8 9 10 11 12 13
private: System::Void richTextBox_srv_output_TextChanged(System::Object^ sender, System::EventArgs^ e) {
int riadky = richTextBox_srv_output->Lines->Length;
for (int i = 0; i < riadky; i++)
{
String^ line;
line = richTextBox_srv_output->Lines[i]->ToString();
if (line->Contains("//"))
{
richTextBox_srv_output->Find(line);
richTextBox_srv_output->SelectionColor = Color::LightGreen;
}
}
}