In this tutorial, you will learn how to use the LimitToList feature to prevent users from entering an item which does not appear in the combo box list.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' The following line is added by Visual Studio 2005. Me.ComposerTableAdapter.Fill(Me.DataSet1.Composer) ' Add some settings. With Me.C1Combo1 .SelectedIndex = 0 .DropdownWidth = 500 .MaxDropDownItems = 10 End With |
To write code in C#
C# |
Copy Code
|
---|---|
// The following line is added by Visual Studio 2005. this.ComposerTableAdapter.Fill(this.DataSet1.Composer); // Add some settings. this.c1Combo1.SelectedIndex = 0; this.c1Combo1.DropdownWidth = 500; this.c1Combo1.MaxDropDownItems = 10; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Prevent MisMatch. With Me.C1Combo1 .LimitToList = True .AutoCompletion = True .SuperBack = True End With End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void Button1_Click( System.object sender, System.EventArgs e) { // Prevent MisMatch. this.c1Combo1.LimitToList = true; this.c1Combo1.AutoCompletion = true; this.c1Combo1.SuperBack = true; } |
Click the Limit To List button. You cannot change the text to something that does not appear in the combo box list.
This concludes the tutorial.