コード例 #1
0
        private void btn_eliminar_Click(object sender, EventArgs e)
        {
            entidades.Producto producto = new entidades.Producto();
            Int32 selectedRowCount      =
                dgv_producto.Rows.GetRowCount(DataGridViewElementStates.Selected);

            if (selectedRowCount > 0)
            {
                producto.codigo = Convert.ToString(dgv_producto.CurrentRow.Cells[0].Value);
                negocio neg = new negocio();
                neg.EliminarProducto(producto);
            }
            else
            {
                MessageBox.Show("Debe seleccionar una fila");
            }
        }