Click here to Skip to main content
11,584,455 members (64,219 online)
Click here to Skip to main content
Add your own
alternative version

Autocomplete Menu

, 19 Mar 2015 LGPL3 204.7K 16.7K 342
Customizable autocomplete menu for RichTextBox, TextBox and other controls
AutocompleteMenu.zip
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
Settings.settings
AutocompleteMenuDemo.zip
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.

My contact email is p_torgashov[at]ukr.net

You may also be interested in...

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