winforms - How to queue and update a dataGridView with 2 buttons in C#? -
i have 2 different buttons couple of textboxes , datagridview.
the first button used insert data , put textboxes , that. want somehow queue data , not put in datagridview.
the second button update button put data have queued datagridview
not lot of information here, i'm gathering, create custom class holds information textboxs:
public class mytextboxclass { private string textbox1 { get; set; } private string textbox2 { get; set; } }
inside form, create global list of custom class...
private list<mytextboxclass> textboxclasslist = new list<mytextboxclass>();
on first button click, create new class , add class global list.
mytextboxclass singleentry = new mytextboxclass { textbox1 = textbox1.text, textbox2 = textbox2.text }; textboxclasslist.add(singleentry);
then second button adding of list items datagridview
foreach(mytextboxclass entry in textboxclasslist) { this.datagridview1.rows.add(entry.textbox1, entry.textbox2); }
Comments
Post a Comment