bool IProduto_c.SelecionaRegistro(object _Selecionado) { System.Windows.Forms.DataGridViewSelectedRowCollection rowCollection = _Selecionado as System.Windows.Forms.DataGridViewSelectedRowCollection; _FocusRegistro = new Beta.Produto_Ent_b() { _ID_Produto = (int)rowCollection[0].Cells[0].Value, _EAN = rowCollection[0].Cells[1].Value.ToString(), _Descricao = rowCollection[0].Cells[2].Value.ToString(), _Unidade = rowCollection[0].Cells[3].Value.ToString(), _Custo = (decimal)rowCollection[0].Cells[4].Value, _Venda = (decimal)rowCollection[0].Cells[5].Value }; return(true); }
public static System.Windows.Forms.DataGridViewSelectedRowCollection get_SelectedRowsTSS( System.Windows.Forms.DataGridView target) { System.Windows.Forms.DataGridViewSelectedRowCollection selectedRows = target.SelectedRows;; // System.Windows.Forms.DataGridViewSelectedRowCollection selectedRows = new System.Windows.Forms.DataGridViewSelectedRowCollection; //Accessor acc = ReflectionAccessor.Wrap(selectedRows); target.Rows.Add(); System.Windows.Forms.DataGridViewRow row1 = target.Rows[0]; row1.Cells[0].Value = "1"; //System.Windows.Forms.DataGridViewRow[] array = new System.Windows.Forms.DataGridViewRow[1]; // array.SetValue(row1, 0); // acc.Call("Insert", 0, row1); selectedRows.Insert(0, row1); return(selectedRows); }