I am attempting to get user input and store it into the columns in a datagridview and save it. All of my attempts this far have been unsuccessful. I can get the information to read out on a multi line text, but I assumed you couldn't have sort able columns in c#. If anyone could help me out here I would be much appreciative.
Where are you trying to save it to? A database? If so then you should create a DataTable and bind it to the grid. Adding a new record is then done by adding a new row to that DataTable. I would suggest binding via a BindingSource, which you would add to the form in the designer.
var table = new DataTable();
table.Columns.Add("ID", typeof (int));
table.Columns.Add("Name", typeof (string));
this.bindingSource1.DataSource = table;
this.dataGridView1.DataSource = this.bindingSource1;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.