You can display multiple columns in the C1Combo control through the Close event of the C1Combo to include multiple column values in the display area of the C1Combo control.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim _textChanging As Boolean = False Private Sub C1Combo1_Close(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1Combo1.Close Dim index As Integer = Me.C1Combo1.SelectedIndex() If (index >= 0) Then _textChanging = True Me.C1Combo1.Text = (Me.C1Combo1.Columns("FirstName").CellText(index) + (" " + (Me.C1Combo1.Columns("LastName").CellText(index) + (" at " + Me.C1Combo1.Columns("Company").CellText(index))))) _textChanging = False End If End Sub Private Sub C1Combo1_SelChange(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) e.Cancel = _textChanging End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
bool _textChanging = false; private void c1Combo1_Close(object sender, System.EventArgs e) { int index = this.c1Combo1.SelectedIndex; if (index >= 0) { _textChanging = true; this.c1Combo1.Text = this.c1Combo1.Columns["FirstName"].CellText(index) + " " + this.c1Combo1.Columns["LastName"].CellText(index) + " at " + this.c1Combo1.Columns["Company"].CellText(index); _textChanging = false; } } private void c1Combo1_SelChange(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = _textChanging; } |
When a company is selected from the list, the first and last name of the contact and the company appears in the C1Combo control.