-
July 6th, 2011, 03:17 AM
#1
C# custom control
Hi,
I am working on a C# Winforms app. I have to create a textbox like control. When the user types text in it, I should show a list of matching options like google suggest. User can choose an option from the list and this option is shown in the textbox towards the left-corner. User can continue typing more text after the option and again we should show matching options. In short, user can type and select any number of options and each selected option becomes part of the static text in the textbox.
Additionally, each previously selected option in the textbox can be removed by clicking a small 'x' mark next to it and the entire textbox can be cleared by clicking a small 'x' mark at the right end of the textbox.
How can I go about achieving this functionality? Creating my own custom controls using GDI+ seems like the way. Any help will be appreciated.
Thanks!
Balaji
-
July 6th, 2011, 04:51 AM
#2
Re: C# custom control
I think a ComboBox will be more suited to your needs, but it is possible with an ordinary TextBox. You'll have to make a UserControl Inherit from TextBox or ComboBox, then you're halfway there.
-
July 6th, 2011, 08:17 AM
#3
Re: C# custom control
Override OnChange or OnType (or somilar) function of textbox. Capture text which has been entered and use it further to find matching options.
Write some code, show it and let us know if error arise.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|