This is a migrated thread and some comments may be shown as answers.

How to restrict user from entering text which is not in a display member of combobox items (2)

3 Answers 59 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Juan Pablo
Top achievements
Rank 1
Juan Pablo asked on 12 Jan 2009, 08:12 PM
Hello, I'm using the first solution you propose on http://www.telerik.com/community/forums/winforms/combobox/how-to-restrict-user-from-entering-text-which-is-not-in-a-display-member-of-combobox-items.aspx and works fine.
I did a little change and the event handler looks like this:

        void cbNameElement_TextChanging(object sender, Telerik.WinControls.TextChangingEventArgs e)
        {
            if (!e.NewValue.Equals(string.Empty))
            {
                if (cbName.FindItem(e.NewValue) == null)
                {
                    this.cbName.Text = string.Empty;
                }
            }
        }

What I accomplished with this is that if the user writes something that is not in the list the text of the combobox is cleared.

Now I have a problem. You clear the text, then you hit ENTER, and you write something that is not on the list, that text isn't cleared.

Please help me with this.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 13 Jan 2009, 10:04 AM
Hello Juan Pablo,

Thank you for the question.

Please find the answer to your question in the regarded forum thread: http://www.telerik.com/community/forums/winforms/combobox/how-to-restrict-user-from-entering-text-which-is-not-in-a-display-member-of-combobox-items.aspx

If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
FIJO FRANCIS T
Top achievements
Rank 2
answered on 14 Jun 2011, 11:41 AM
Hi ,
Note :-Urgent client issue , please reply fast.

I do have simlar issue ,  i have autocomplete event in a text box , while i type it retuns multiple columns according to items avillable but if the item is not present i have to restrict the user to type , that means  if the item is not present in collection text box should be keep cleared .
With Thanks,
Fijo Francis T.
9986573129
0
Nikolay
Telerik team
answered on 15 Jun 2011, 11:37 AM
Hello FIJO FRANCIS T,

I am not sure if your question is directly related to RadControls for WinForms. Could you please share which is the RadControl you are using?

The provided link in this thread should actually point to:
http://www.telerik.com/community/forums/winforms/combobox-and-listbox/how-to-restrict-user-from-entering-text-which-is-not-in-a-display-member-of-combobox-items.aspx

A bit off topic, please note that if you have urgent issues that require quick responses from us, you have to submit a support ticket from the licensed account. This is so, because support tickets are reviewed and handled according to the license that you have.

All the best,
Nikolay
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Juan Pablo
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
FIJO FRANCIS T
Top achievements
Rank 2
Share this question
or