foreach (Control ctrl in this.Controls) { if (ctrl is DataGridView && ctrl.Visible == true) { DataGridView dgv = ctrl as DataGridView; foreach (DataGridViewRow row in dgv.Rows) { //commit to database } } }
for each crtl as control in me.controls if typeof ctrl is datagridview and ctrl.visible = true then for each row as datagridviewrow in ctrl.rows 'commit to database next end if next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)