Click here to Skip to main content
13,352,428 members (39,400 online)
Click here to Skip to main content

Stats

469K views
22.9K downloads
364 bookmarked
Posted 13 Apr 2012

Autocomplete Menu

, 19 Mar 2015
Customizable autocomplete menu for RichTextBox, TextBox and other controls
AutocompleteMenu
AutocompleteMenu.suo
AutocompleteMenu
bin
Debug
AutocompleteMenu.dll
AutocompleteMenu.pdb
Release
obj
Debug
AutocompleteMenu.csproj.GenerateResource.Cache
AutocompleteMenu.csprojResolveAssemblyReference.cache
AutocompleteMenu.dll
AutocompleteMenu.pdb
AutocompleteMenuNS.AutocompleteMenu.resources
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Properties
Tester
bin
Debug
AutocompleteMenu.dll
AutocompleteMenu.pdb
Tester.exe
Tester.pdb
Tester.vshost.exe
Tester.vshost.exe.manifest
Release
obj
x86
Debug
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Tester.AdvancedSample.resources
Tester.ComboboxSample.resources
Tester.csproj.GenerateResource.Cache
Tester.csprojResolveAssemblyReference.cache
Tester.CustomItemSample.resources
Tester.CustomListViewSample.resources
Tester.DataGridViewSample.resources
Tester.DynamicMenuSample.resources
Tester.DynamicTooltipSample.resources
Tester.exe
Tester.ExtraLargeSample.resources
Tester.MainForm.resources
Tester.MultiColumnSample.resources
Tester.pdb
Tester.Properties.Resources.resources
Tester.Sandbox.resources
Tester.SimplestSample.resources
Properties
AutocompleteMenuDemo
AutocompleteMenu.dll
Tester.exe
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using AutocompleteMenuNS;

namespace Tester
{
    public partial class ComboboxSample : Form
    {
        public ComboboxSample()
        {
            InitializeComponent();
            BuildAutocompleteMenu();
        }

        private void BuildAutocompleteMenu()
        {
            var items = new List<AutocompleteItem>();

            //get all classes and methods of Form's assembly
            foreach (var cl in Assembly.GetAssembly(typeof(Form)).GetTypes())
            {
                items.Add(new SubstringAutocompleteItem(cl.Name, false) {ImageIndex = 0});
                foreach(var method in cl.GetMethods())
                    items.Add(new SubstringAutocompleteItem(method.Name, false) { ImageIndex = 2, MenuText = cl.Name + "." + method.Name + "()" });
            }

            //set as autocomplete source
            autocompleteMenu1.SetAutocompleteItems(items);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

Pavel Torgashov
Software Developer Freelancer
Ukraine Ukraine
I am Pavеl Tоrgаshоv, and I live in Kyiv, Ukraine.
I've been developing software since 1998.
Main activities: processing of large volumes of data, statistics, computer vision and graphics.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 19 Mar 2015
Article Copyright 2012 by Pavel Torgashov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid