We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridListBox and AutoComplete

Thread ID:

Created:

Updated:

Platform:

Replies:

23377 Jan 11,2005 02:06 PM UTC Jan 11,2005 03:30 PM UTC WinForms 1
loading
Tags: GridControl
Gil Kalo
Asked On January 11, 2005 02:06 PM UTC

Hi, I''m looking for a list box which responds to key stroks and updates selection as in auto complete feature. I tried to work with GridListControl, but auto complete doesn''t seems to work there?! Any control or way to do this? Thanks, Gil K

Administrator [Syncfusion]
Replied On January 11, 2005 03:30 PM UTC

The standalone GridListControl does not support AutoComplete, but the GirdListControl dropdown that appears in cells does. If you just want to do a first letter match, you could probably do this by handling the GridListControl.KeyDown event. Here is a little minimal handler that worked for me in our GridListControlSample. (You have to click the control first to it focus. But after that typing a letter takes you to the State Abbreviation.)

private void ListBox1_KeyDown(object sender, KeyEventArgs e)
{
	//Console.WriteLine("ListBox1_KeyDown");
	int start = this.ListBox1.SelectedIndex;
	int i = start + 1;
	string s = e.KeyCode.ToString();
	while (i > 0 && i < this.ListBox1.Grid.RowCount)
	{
		if(this.ListBox1.Grid[i + 1, 1].Text.StartsWith(s))
		{
			this.ListBox1.SelectedIndex = i;
			return;
		}
		i += 1;
	}
	i = 0;
	while(i < start)
	{
		if(this.ListBox1.Grid[i + 1, 1].Text.StartsWith(s))
		{
			this.ListBox1.SelectedIndex = i;
			return;
		}
		i += 1;
	}
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;