Hi,
it´s a stupid question.
I don´t know whether I have written in the correct thread, I wanted to write in editor´s thread.
my question is this. I can´t set a background color to my textbox. I have tried this code snippet but didn´t change its color.
Do you know why I can´t change it?
Thank you
it´s a stupid question.
I don´t know whether I have written in the correct thread, I wanted to write in editor´s thread.
my question is this. I can´t set a background color to my textbox. I have tried this code snippet but didn´t change its color.
this.txtName.BackColor = System.Drawing.Color.Yellow; |
Do you know why I can´t change it?
Thank you
7 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 11 May 2009, 11:25 AM
Hi Paxti,
Try the following code and see whether its working fine for you.
cs:
You can also refer the following forum link which discusses similar scenario.
http://www.telerik.com/community/forums/winforms/general-discussions/backcolor.aspx
Thanks,
Princy.
Try the following code and see whether its working fine for you.
cs:
private void radButton1_Click(object sender, EventArgs e) |
{ |
((RadTextBoxItem)this.radTextBox1.TextBoxElement.GetChildrenByType(typeof(RadTextBoxItem))[0]).BackColor = Color.Yellow; |
} |
You can also refer the following forum link which discusses similar scenario.
http://www.telerik.com/community/forums/winforms/general-discussions/backcolor.aspx
Thanks,
Princy.
0
Hi guys,
Princy, thank you for your assistance.
Patxi, as it is pointed out in the forum link that Princy provided, you can change the BackColor of RadTextBox control by changing the BackColor of its subelements RadTextBoxItem and FillPrimitive:
If you have additional questions, feel free to contact me.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Princy, thank you for your assistance.
Patxi, as it is pointed out in the forum link that Princy provided, you can change the BackColor of RadTextBox control by changing the BackColor of its subelements RadTextBoxItem and FillPrimitive:
this.radTextBox1.TextBoxElement.TextBoxItem.BackColor = Color.Red; |
((FillPrimitive)this.radTextBox1.TextBoxElement.Children[1]).BackColor = Color.Red; |
If you have additional questions, feel free to contact me.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Chan
Top achievements
Rank 1
answered on 26 Mar 2013, 09:27 AM
After invoking these lines i got the following error. How to sort it?
Error 3 The type or namespace name 'FillPrimitive' could not be found (are you missing a using directive or an assembly reference?)
Error 1 'Telerik.WinControls.UI.RadTextBoxControlElement' does not contain a definition for 'TextBoxItem' and no extension method 'TextBoxItem' accepting a first argument of type 'Telerik.WinControls.UI.RadTextBoxControlElement' could be found (are you missing a using directive or an assembly reference?)
Error 3 The type or namespace name 'FillPrimitive' could not be found (are you missing a using directive or an assembly reference?)
Error 1 'Telerik.WinControls.UI.RadTextBoxControlElement' does not contain a definition for 'TextBoxItem' and no extension method 'TextBoxItem' accepting a first argument of type 'Telerik.WinControls.UI.RadTextBoxControlElement' could be found (are you missing a using directive or an assembly reference?)
0
Chan
Top achievements
Rank 1
answered on 26 Mar 2013, 09:28 AM
After invoking these lines i got the following error. How to sort it?
Error 3 The type or namespace name 'FillPrimitive' could not be found (are you missing a using directive or an assembly reference?)
Error 1 'Telerik.WinControls.UI.RadTextBoxControlElement' does not contain a definition for 'TextBoxItem' and no extension method 'TextBoxItem' accepting a first argument of type 'Telerik.WinControls.UI.RadTextBoxControlElement' could be found (are you missing a using directive or an assembly reference?)
Error 3 The type or namespace name 'FillPrimitive' could not be found (are you missing a using directive or an assembly reference?)
Error 1 'Telerik.WinControls.UI.RadTextBoxControlElement' does not contain a definition for 'TextBoxItem' and no extension method 'TextBoxItem' accepting a first argument of type 'Telerik.WinControls.UI.RadTextBoxControlElement' could be found (are you missing a using directive or an assembly reference?)
0
Hello Arpus,
Thank you for writing.
It seems that you are using RadTextBoxControl not RadTextBox. To change the BackColor of RadTextBoxControl use this code:
I hope this helps.
Kind regards,
Stefan
the Telerik team
Thank you for writing.
It seems that you are using RadTextBoxControl not RadTextBox. To change the BackColor of RadTextBoxControl use this code:
radTextBoxControl1.TextBoxElement.BackColor = Color.Red;
I hope this helps.
Kind regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more.
Check out all of the latest highlights.
0
Chan
Top achievements
Rank 1
answered on 29 Mar 2013, 05:11 AM
Helo ! Stefan ,
Thanks a lot it worked !!!
I have another doubt.
As u said, u r right i used RadTextBoxControl.
I used this control to search records (Text box to search records with autocomplete feature).
Now, i want my autocomplete to be similar as of google search box works.
like, the moment i started typing text in the textboxcontrol the first matching record should appear as watermark, instead of highlighted and selected.This autocomplete records being pulled from database.
While typing the text in radtextboxcontrol, the matching characters should be highlighted with bold fonts and the rest characters from matching records should be watermarked.
For illustration of my problem you may have look on google searchtextbox.
Looking ahead for your response.
Thanks,
Arpus
Thanks a lot it worked !!!
I have another doubt.
As u said, u r right i used RadTextBoxControl.
I used this control to search records (Text box to search records with autocomplete feature).
Now, i want my autocomplete to be similar as of google search box works.
like, the moment i started typing text in the textboxcontrol the first matching record should appear as watermark, instead of highlighted and selected.This autocomplete records being pulled from database.
While typing the text in radtextboxcontrol, the matching characters should be highlighted with bold fonts and the rest characters from matching records should be watermarked.
For illustration of my problem you may have look on google searchtextbox.
Looking ahead for your response.
Thanks,
Arpus
0
Hello Arpus,
Your question is not related to the initial question of this thread - see p4 from our forum rules. Please avoid mixing different subjects in the same thread as this makes it harder for the users to find the information they are looking for. If you cannot find a suitable thread, feel free to open a new one.
Kind regards,
Stefan
the Telerik team
Your question is not related to the initial question of this thread - see p4 from our forum rules. Please avoid mixing different subjects in the same thread as this makes it harder for the users to find the information they are looking for. If you cannot find a suitable thread, feel free to open a new one.
Kind regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more.
Check out all of the latest highlights.