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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AutoComplete Control

Thread ID:

Created:

Updated:

Platform:

Replies:

66784 Aug 2,2007 11:53 AM UTC Aug 2,2007 11:56 PM UTC Windows Forms 1
loading
Tags: Tools
Scott Griswold
Asked On August 2, 2007 11:53 AM UTC

Hi,

I am using the auto complete control to present the user a list of patient names. The control works well. The issue is that when a patient is selected I am trying to figure out how to uniquely identify that patient (i.e. with a unique identifier) is there a way this can be done with the auto complete control?

Thanks,

Scott

Ajish [Syncfusion]
Replied On August 2, 2007 11:56 PM UTC

Hi Scott,

This can be done by setting a datasource for the autocomplete datasource having multicolumns one column as the unique key of the Patient and another as the Patient Name. Using this relation we can get the unique identity of the patient. Here is the code for setting datasource with multiple column

for (int i = 0; i < 10; ++i)
{
DataRow dr = dt.NewRow();

dr[0] = "Patient"+ i.ToString();
dr[1] = RandomString(ran.Next(9));

dt.Rows.Add(dr);

}

this.autoComplete1.DataSource = dt;
this.autoComplete1.RefreshColumns();

this.autoComplete1.Columns[1].MatchingColumn = true;
this.autoComplete1.Columns[0].Visible = false;

and the Autocomplete item selection event can be used to identify the unique id of the patient. Here is the code for it,

private void autoComplete1_AutoCompleteItemSelected(object sender, Syncfusion.Windows.Forms.Tools.AutoCompleteItemEventArgs args)
{
if (this.autoComplete1.SelectedIndex >=0)
{
Console.WriteLine(dt.Rows[this.autoComplete1.SelectedIndex][0].ToString());
}
}

Here is the sample for your reference,

Sample: http://websamples.syncfusion.com/samples/Tools.Windows/F66784/main.htm

Kindly take a look and let me know if this helps.

Regards,
Ajish.

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

;