Design-time support for the AddItem mode of C1List is now available. The following steps demonstrate how to add items and set a layout at design time.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
With Me.C1Combo1 .HoldFields() .AddItem("Greg Daryll;0") .AddItem("Jane Lambert;1") .AddItem("Allen Clark;1") .AddItem("David Elkins;1") .AddItem("Carl Ziegler;0") .AddItem("William Yahner;1") End With |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1Combo1.HoldFields(); this.c1Combo1.AddItem("Greg Daryll;0"); this.c1Combo1.AddItem("Jane Lambert;1"); this.c1Combo1.AddItem("Allen Clark;1"); this.c1Combo1.AddItem("David Elkins;1"); this.c1Combo1.AddItem("Carl Ziegler;0"); this.c1Combo1.AddItem("William Yahner;1"); |
For example, replace the code entered in the Form_Load event with the following code:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
With Me.C1Combo1 .HoldFields() .SuspendBinding() .AddItem ("Greg Daryll;0") .AddItem ("Jane Lambert;1") .AddItem ("Allen Clark;1") .AddItem ("David Elkins;1") .AddItem ("Carl Ziegler;0") .AddItem ("William Yahner;1") .ResumeBinding() .Rebind() End With |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1Combo1.HoldFields(); this.c1Combo1.SuspendBinding(); this.c1Combo1.AddItem ("Greg Daryll;0"); this.c1Combo1.AddItem ("Jane Lambert;1"); this.c1Combo1.AddItem ("Allen Clark;1"); this.c1Combo1.AddItem ("David Elkins;1"); this.c1Combo1.AddItem ("Carl Ziegler;0"); this.c1Combo1.AddItem ("William Yahner;1"); this.c1Combo1.ResumeBinding(); this.c1Combo1.Rebind(); |
In this tutorial only a small amount of data was used, so you may not notice a difference in the processing time. For larger amounts of data, use the AddItem method for a much faster processing time.
This concludes the tutorial.