Page 1 of 1

How change the forecolor?

Posted: Thu Jul 08, 2010 2:59 am
by jjc
Hi ,
i have a Button in a stiForm with this code:

if (CheckedListBoxControl4.SelectedIndex >= 0)

{
for (int i=0; i<CheckedListBoxControl4.Control.CheckedItems.Count; i++)
{
string vari = CheckedListBoxControl4.Control.CheckedItems.ToString();

Hotel_Meals_TBL.First();

while (!Hotel_Meals_TBL.IsEof)
{
switch(vari)

{
case ("GOLDEN PALACE") :
chkGOLDENPALACE.Checked = true;
chkGOLDENPALACE.ForeColor = Color.Red;
break;

case ("KHEMARA BATTAMBANG") :
chkKHEMARABATTAMBANG.Checked = true;
txtKHEMARABATTAMBANG.Brush =new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Red);
break;

case ("LA VILLA") :
chkLAVILLA.Checked = true;
break;




}
Hotel_Meals_TBL.Next();
}
}
}


when a CheckedBox is checked(true) i wish change the ForeColor of the TextBox but with my code i can not.

Where i wrong in my code?

Thanks for your attention.

Have a good day.

Cheers

How change the forecolor?

Posted: Thu Jul 08, 2010 6:24 am
by Ivan
Hello,

For change color of textbox please use the following code, for example:

Code: Select all

TextBoxControl1.Control.ForeColor = Color.Red;
Thank you.

How change the forecolor?

Posted: Thu Jul 08, 2010 8:27 pm
by jjc
Hi Ivan,
your code is right , i can change he forecolor of the textbox.:blush:

Thanks so much for your support.

Have a good day.

Cheers

How change the forecolor?

Posted: Thu Jul 08, 2010 10:34 pm
by Andrew
Have a good day too! :biggrin: