My code only gets the values of one row. But my user writes text into many rows and I have to get all their values to write them into a JSON. How can I get the values from all rows?
var llist = new List<MyClass>();
var obj = new MyClass()
{
Nachricht = dataGridView1.CurrentRow.Cells["Value"].Value.ToString(),
Datum = dataGridView1.CurrentRow.Cells["File"].Value.ToString()
};
llist.Add(obj);
string export = JsonConvert.SerializeObject(new { types = llist }, Formatting.Indented);
File.WriteAllText(@Settings.Default.folder + "\\" + "upload" + "\\" + "export.json", export);