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.

ComboBoxAutoComplete and DataBinding

Thread ID:

Created:

Updated:

Platform:

Replies:

52991 Dec 6,2006 03:20 PM Dec 13,2006 01:36 PM Windows Forms 5
loading
Tags: Tools
Administrator [Syncfusion]
Asked On December 6, 2006 03:20 PM

Hello,

I have a requirement to integrate auto complete functionality inside of a form that is using databinding as the mechanism to get datat into/out of my custom objects. I have attempted to use the ComboBoxAutoComplete control with minimal success. I would like assistance with how best to configure the control to facilitate databinding directly against my custom object.

My ComboBoxAutoComplete control contains an IList of custom objects, and is associated with a given property on my custom object. I want to bind to the SelectedItem property of the control, but this has not quite processed due to the interaction between the ComboBox control and the associated AutoComplete control. Some of my problems may be caused by the "OverrideCombo" property on the AutoComplete, but I cannot get the desired behavior, even when modifying this property.

What is the proper structure for getting object databinding to play nicely with the ComboBoxAutoComplete control?

Thanks for any assistance you can provide.

Anupama Roy [Syncfusion]
Replied On December 11, 2006 01:25 AM

Hi John,

Create the same number of columns as the properties in your IList of custom objects using the Columns property of internal AutoCompleteControl.Or create the number of columns that you would like to display.

this.comboBoxAutoComplete1.AutoCompleteControl.Columns.Add(new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("LongName", 25, true));

this.comboBoxAutoComplete1.AutoCompleteControl.Columns.Add(new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("ShortName", 50, true));


Note that the names of the columns should also be same as the respective property of your custom object.For eg: if you have the property name as ShortName and you want this to be added as a column,then within the parameter of AutoCompleteDataColumnInfo,the name should be ShortName itself.


public string ShortName

//StringName will be displayed in the column Header in the ComboBoxAutoComplete.
{

get
{
return myShortName;
}

}

Also,in order to set the SelectedItem to a particular property,you can set that particular column as the MatchingColumn.

this.comboBoxAutoComplete1.AutoCompleteControl.Columns[1].MatchingColumn = true;

The DataSource, DisplayMember and the ValueMember properties of the ComboBoxAutoComplete control are actually properties from the .NET ComboBox control, since the ComboBoxAutoComplete control internally uses the .NET ComboBox. However, these properties are not useful in the context of a ComboBoxAutoComplete control with an internal AutoComplete, and we recommend you not to use these.

Please take a look at the sample attached and let me know if this does not meet your requirement.

ViewSample

Best Regards,

Anu.



Administrator [Syncfusion]
Replied On December 12, 2006 10:09 AM

Hi Anu,

Sorry to bother, but can you post that as a .NET 1.1, Visual Studio 2003 project? Our shop isn't up to 2.0 or VS 2005 yet.

Thanks.

>Hi John,

Create the same number of columns as the properties in your IList of custom objects using the Columns property of internal AutoCompleteControl.Or create the number of columns that you would like to display.

this.comboBoxAutoComplete1.AutoCompleteControl.Columns.Add(new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("LongName", 25, true));

this.comboBoxAutoComplete1.AutoCompleteControl.Columns.Add(new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("ShortName", 50, true));


Note that the names of the columns should also be same as the respective property of your custom object.For eg: if you have the property name as ShortName and you want this to be added as a column,then within the parameter of AutoCompleteDataColumnInfo,the name should be ShortName itself.


public string ShortName

//StringName will be displayed in the column Header in the ComboBoxAutoComplete.
{

get
{
return myShortName;
}

}

Also,in order to set the SelectedItem to a particular property,you can set that particular column as the MatchingColumn.

this.comboBoxAutoComplete1.AutoCompleteControl.Columns[1].MatchingColumn = true;

The DataSource, DisplayMember and the ValueMember properties of the ComboBoxAutoComplete control are actually properties from the .NET ComboBox control, since the ComboBoxAutoComplete control internally uses the .NET ComboBox. However, these properties are not useful in the context of a ComboBoxAutoComplete control with an internal AutoComplete, and we recommend you not to use these.

Please take a look at the sample attached and let me know if this does not meet your requirement.

ViewSample

Best Regards,

Anu.



Anupama Roy [Syncfusion]
Replied On December 12, 2006 01:17 PM


Hi John,

Please have a look at the attached sample and let me know if this does not meet your requirement.

sample


Best Regards,

Anu.

Administrator [Syncfusion]
Replied On December 12, 2006 02:04 PM

Hi Anu,

Sorry again, but the link to the updated sample does not work properly.

Thanks.

>
Hi John,

Please have a look at the attached sample and let me know if this does not meet your requirement.

sample


Best Regards,

Anu.

Anupama Roy [Syncfusion]
Replied On December 13, 2006 01:36 PM

Hi John,

I am afraid,the link seems to be broken.Please have a look at this.

Regards,

Anu.




>Hi Anu,

Sorry again, but the link to the updated sample does not work properly.

Thanks.

>
Hi John,

Please have a look at the attached sample and let me know if this does not meet your requirement.

sample


Best Regards,

Anu.

sample_comboboxAuto.zip

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.

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.

;