Articles in this section
Category / Section

Is there a way to format the text in a standard TextBox control that uses an AutoComplete component based on the data source of the AutoComplete?

1 min read

 

Yes,It is possible to format the text in a standard TextBox control that uses an AutoComplete component based on the data source of the AutoComplete.

You can handle the AutoCompleteItemSelected event and retrieve other columns of same table using args.ItemArray[Index] where you need to specify the index of column required.Also,the args.SelectedValue can display the required text as shown below. 

C#

private void autoComplete2_AutoCompleteItemSelected(object sender, Syncfusion.Windows.Forms.Tools.AutoCompleteItemEventArgs args)

{

string CurrentText= this.textBox2.Text;

args.SelectedValue = CurrentText + args.ItemArray[args.MatchColumnIndex].ToString() +"-"+ args.ItemArray[0].ToString()+ ","+args.ItemArray[1].ToString ();

args.Handled = true;

}

 

VB

Private Sub autoComplete2_AutoCompleteItemSelected(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.AutoCompleteItemEventArgs)

Dim CurrentText As String= Me.textBox2.Text

args.SelectedValue = CurrentText & args.ItemArray(args.MatchColumnIndex).ToString() +"-"+ args.ItemArray(0).ToString()+ ","+args.ItemArray(1).ToString ()

args.Handled = True

End Sub

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied