c# - Add new row to DataGridView using textboxes -


i trying add textboxes datagridview code doesn't work

datagridview1.rows[0].cells[0].value = textbox6.text; datagridview1.rows[0].cells[1].value = textbox5.text; datagridview1.rows[0].cells[2].value = textbox7.text; datagridview1.rows[0].cells[3].value = datetimepicker3.value; 

here suggest knowing indeed in forms project. see person has suggested already, adding in assertion if of textbox controls empty row not added.

if ((!string.isnullorwhitespace(textbox6.text)) || (!!string.isnullorwhitespace(textbox5.text)) || (!string.isnullorwhitespace(textbox7.text))) {     datagridview1.rows.add(new object[] {textbox6.text,textbox5.text,textbox7.text,datetimepicker3.value }); } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -