| List for WinForms Tutorials > Tutorial 3 AddItem Mode |
This tutorial demonstrates how you can manually add information to a list using the AddItem Mode without having to bind C1List to a DataSet.
Create a new .NET project and add:
The form should look like the following:

To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
With Me.C1List1
.AddItemTitles("First Name; LastName; Phone Number")
.AddItem("Greg;Daryll;412-657-3412")
.AddItem("Jane;Lambert;567-123-6785")
.AddItem("Allen;Clark;675-345-9087")
.AddItem("David;Elkins;564-345-2635")
.AddItem("Carl;Ziegler;412-678-2351")
.AddItem("William;Yahner;412-980-6754")
End With
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1List1.AddItemTitles("First Name; LastName; Phone Number");
this.c1List1.AddItem("Greg;Daryll;412-657-3412");
this.c1List1.AddItem("Jane;Lambert;567-123-6785");
this.c1List1.AddItem("Allen;Clark;675-345-9087");
this.c1List1.AddItem("David;Elkins;564-345-2635");
this.c1List1.AddItem("Carl;Ziegler;412-678-2351");
this.c1List1.AddItem("William;Yahner;412-980-6754");
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1List1.AddItem(Me.TextBox1.Text + ";" + Me.TextBox2.Text + ";" + Me.TextBox3.Text) |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1List1.AddItem(this.TextBox1.Text + ";" + this.TextBox2.Text + ";" + this.TextBox3.Text); |
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Try
Me.C1List1.RemoveItem(Me.C1List1.SelectedIndex)
Catch
MessageBox.Show("Select an item from the list first.", "List")
End Try
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
try
{
this.c1List1.RemoveItem(this.C1List1.SelectedIndex);
}
catch
{
MessageBox.Show("Select an item from the list first.", "List");
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1List1.ClearItems() |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1List1.ClearItems(); |
|

![]() |
Note: For faster data processing, you can use the C1ListBase.AddItem method. |
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
With Me.C1List1
.AddItemTitles("First Name; LastName; Phone Number")
.SuspendBinding()
.AddItem("Greg;Daryll;412-657-3412")
.AddItem("Jane;Lambert;567-123-6785")
.AddItem("Allen;Clark;675-345-9087")
.AddItem("David;Elkins;564-345-2635")
.AddItem("Carl;Ziegler;412-678-2351")
.AddItem("William;Yahner;412-980-6754")
.ResumeBinding()
End With
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.C1List1.AddItemTitles("First Name; LastName; Phone Number");
this.C1List1.SuspendBinding();
this.C1List1.AddItem("Greg;Daryll;412-657-3412");
this.C1List1.AddItem("Jane;Lambert;567-123-6785");
this.C1List1.AddItem("Allen;Clark;675-345-9087");
this.C1List1.AddItem("David;Elkins;564-345-2635");
this.C1List1.AddItem("Carl;Ziegler;412-678-2351");
this.C1List1.AddItem("William;Yahner;412-980-6754");
this.C1List1.ResumeBinding();
|
|
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 C1ListBase.AddItem method for a much faster processing time.
This concludes the tutorial.