.net - Remove row from DataGridView -
in order initialize vouchersdgv data grid view i'm using following
dgv.allowusertodeleterows = true = 1 dgv.rowcount - 1 dgv.rows.remove(dgv.rows(i - 1)) dgv.refresh() next
but when i'm runing first time take error of
{"uncommitted new row cannot deleted."} system.invalidoperationexception
if continue , run code , write new row in data grid , try initialize again (now have 2 rows, 1 has data , other empty) take error
{"uncommitted new row cannot deleted."} system.invalidoperationexception
i can't solve it, please there assist me on that?
if not dgv.rows(i).isnewrow dgv.rows.removeat(i) end if
add condition loop. alternatively, use dgv.rejectchanges() reset row status original.
Comments
Post a Comment