C# custom control
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: C# custom control

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Question 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

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,091

    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.

  3. #3
    Join Date
    Aug 2008
    Posts
    72

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center