| List for WinForms Tutorials > Tutorial 18 Search Using MatchEntry |
In this tutorial, you will learn how to search a record from a list using the MatchEntry, MatchCol, MatchCompare and MatchEntryTimeout properties.
![]() |
Note: See Adding the C1List Components to a Project for information on adding a component to the Toolbox. |

To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' The following line is added by Visual Studio 2005.
Me.CustomersTableAdapter.Fill(Me.DsCustomers.Customers)
' Fill Combo1.
With Me.C1Combo1
.DataMode = C1.Win.C1List.DataModeEnum.AddItem
.AddItem("Current Mouse Position")
.AddItem("DisplayMember")
.AddItem("Current Selected Col")
.SelectedIndex = 0
End With
' Fill Combo2.
With Me.C1Combo2
.DataMode = C1.Win.C1List.DataModeEnum.AddItem
.AddItem("Partial Include")
.AddItem("Equal")
.AddItem("Less Than")
.AddItem("Greater Than")
.SelectedIndex = 0
End With
' Fill Combo3.
With Me.C1Combo3
.DataMode = C1.Win.C1List.DataModeEnum.AddItem
.AddItem("Standard")
.AddItem("Extended")
.SelectedIndex = 0
End With
' Fill Combo4.
With Me.C1Combo4
.DataMode = C1.Win.C1List.DataModeEnum.AddItem
.AddItem("2000")
.AddItem("1000")
.AddItem("3000")
.SelectedIndex = 0
End With
' Start.
With Me.C1List1
.MatchCol = C1.Win.C1List.MatchColEnum.CurrentMousePos
.MatchCompare = C1.Win.C1List.MatchCompareEnum.PartiallyEqual
.MatchEntry = C1.Win.C1List.MatchEntryEnum.Standard
.MatchEntryTimeout = 2000
End With
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void Form1_Load( System.object sender, System.EventArgs e)
{
// The following line is added by Visual Studio 2005.
this.OleDbDataAdapter1.Fill(this.DsCustomers1);
// Fill Combo1.
this.c1Combo1.DataMode = C1.Win.C1List.DataModeEnum.AddItem;
this.c1Combo1.AddItem("Current Mouse Position");
this.c1Combo1.AddItem("DisplayMember");
this.c1Combo1.AddItem("Current Selected Col");
this.c1Combo1.SelectedIndex = 0;
// Fill Combo2.
this.c1Combo2.DataMode = C1.Win.C1List.DataModeEnum.AddItem;
this.c1Combo2.AddItem("Partial Include");
this.c1Combo2.AddItem("Equal");
this.c1Combo2.AddItem("Less Than");
this.c1Combo2.AddItem("Greater Than");
this.c1Combo2.SelectedIndex = 0;
// Fill Combo3.
this.c1Combo3.DataMode = C1.Win.C1List.DataModeEnum.AddItem;
this.c1Combo3.AddItem("Standard");
this.c1Combo3.AddItem("Extended");
this.c1Combo3.SelectedIndex = 0;
// Fill Combo4.
this.c1Combo4.DataMode = C1.Win.C1List.DataModeEnum.AddItem;
this.c1Combo4.AddItem("2000");
this.c1Combo4.AddItem("1000");
this.c1Combo4.AddItem("3000");
this.c1Combo4.SelectedIndex = 0;
// Start.
this.c1List1.MatchCol = C1.Win.C1List.MatchColEnum.CurrentMousePos;
this.c1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.PartiallyEqual;
this.c1List1.MatchEntry = C1.Win.C1List.MatchEntryEnum.Standard;
this.c1List1.MatchEntryTimeout = 2000;
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub C1Combo1_Change(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1Combo1.Change
Select Case Me.C1Combo1.Text
Case "Current Mouse Position"
Me.C1List1.MatchCol = C1.Win.C1List.MatchColEnum.CurrentMousePos
Case "ListField"
Me.C1List1.MatchCol = C1.Win.C1List.MatchColEnum.DisplayMember
Case "Current Selected Col"
Me.C1List1.MatchCol = C1.Win.C1List.MatchColEnum.CurrentSelectedCol
End Select
End Sub
Private Sub C1Combo2_Change(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1Combo2.Change
Select Case Me.C1Combo2.Text
Case "Partial Include"
Me.C1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.PartiallyEqual
Case "Equal"
Me.C1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.Equal
Case "Less Than"
Me.C1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.LessThan
Case "Greater Than"
Me.C1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.GreaterThan
End Select
End Sub
Private Sub C1Combo3_Change(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1Combo3.Change
Select Case Me.C1Combo3.Text
Case "Standard"
Me.C1List1.MatchEntry = C1.Win.C1List.MatchEntryEnum.Standard
Case "Extended"
Me.C1List1.MatchEntry = C1.Win.C1List.MatchEntryEnum.Extended
End Select
End Sub
Private Sub C1Combo4_Change(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1Combo4.Change
Select Case Me.C1Combo4.Text
Case "2000"
Me.C1List1.MatchEntryTimeout = 2000
Case "1000"
Me.C1List1.MatchEntryTimeout = 1000
Case "3000"
Me.C1List1.MatchEntryTimeout = 3000
End Select
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void C1Combo1_Change( object sender, System.EventArgs e)
{
switch (this.C1Combo1.Text)
{
case "Current Mouse Position":
this.c1List1.MatchCol = C1.Win.C1List.MatchColEnum.CurrentMousePos;
break;
case "ListField":
this.c1List1.MatchCol = C1.Win.C1List.MatchColEnum.DisplayMember;
break;
case "Current Selected Col":
this.c1List1.MatchCol = C1.Win.C1List.MatchColEnum.CurrentSelectedCol;
break;
}
}
private void C1Combo2_Change( object sender, System.EventArgs e)
{
switch (this.C1Combo2.Text)
{
case "Partial Include":
this.c1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.PartiallyEqual;
break;
case "Equal":
this.c1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.Equal;
break;
case "Less Than":
this.c1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.LessThan;
break;
case "Greater Than":
this.c1List1.MatchCompare = C1.Win.C1List.MatchCompareEnum.GreaterThan;
break;
}
}
private void C1Combo3_Change( object sender, System.EventArgs e)
{
switch (this.C1Combo3.Text)
{
case "Standard";
this.c1List1.MatchEntry = C1.Win.C1List.MatchEntryEnum.Standard;
break;
case "Extended";
this.c1List1.MatchEntry = C1.Win.C1List.MatchEntryEnum.Extended;
break;
}
}
private void C1Combo4_Change( object sender, System.EventArgs e)
{
switch (this.C1Combo4.Text)
{
case "2000";
this.c1List1.MatchEntryTimeout = 2000;
break;
case "1000";
this.c1List1.MatchEntryTimeout = 1000;
break;
case "3000";
this.c1List1.MatchEntryTimeout = 3000;
break;
}
}
|
|
![]() |
Note: When C1Combo has the focus, press F4 to open the drop-down box. |


This concludes the tutorial.