I know that this code
public void FillListBoxColoredText(ListBox LBx, List<string> liststX)
{
int iCount = liststX.Count();
for (int ii = 0; ii < iCount; ii++) {
if (liststX[ii].Contains("blue"))
LBx.Items.Add(liststX[ii], Foreground = #0000ff);
else if (liststX[ii].Contains("red"))
LBx.Items.Add(liststX[ii], Foreground = #ff0000);
else if (liststX[ii].Contains("green"))
LBx.Items.Add(liststX[ii], Foreground = #00ff00);
}
is not correct. It strives to indicate what I want.