Ani
Ani

Reputation: 608

populate datagridview from a list and edit the list (adding)

I have a List

List <string> aList = new List<string>();
aList.Add("A,B");
aList.Add("A,C");
aList.Add("A,D");
aList.Add("A,E");

I have datagridview, and I want to display this list on this datagridview.

aDataGridView.DataSouce = aList; // Dosent seems to work.

When this is displayed on the datagridview I want the user to add to it from the gridview.For example:

DataGridView:
(This column added by the user) and if user does not add anyhing, that row is excluded from aList.
A B apple
A C banana
A D
A E

Is there anyway I can achieve this. sorry I am a beginner in C#. Many Thanks

Upvotes: 4

Views: 769

Answers (1)

Michael Eakins
Michael Eakins

Reputation: 4179

I would suggest utilizing a datatable as it can ready be used as a datagridview.datasource.

Upvotes: 2

Related Questions