Exemplo n.º 1
0
        private void dvgEditoriales_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    string cod    = Convert.ToString(dvgEditoriales.Rows[0].Cells[0].Value);
                    string nombre = Convert.ToString(dvgEditoriales.Rows[0].Cells[1].Value);
                    txtNombre.Text = nombre;
                    txtCodigo.Text = cod;

                    ModeloDUsuario Obj   = new ModeloDUsuario();
                    DataTable      tabla = Obj.MostrarEditorial(cod, nombre);

                    foreach (DataRow row in tabla.Rows)
                    {
                        txtCorreo.Text    = Convert.ToString(row["Correo"]);
                        txtDireccion.Text = Convert.ToString(row["Direccion"]);
                        txtTelefono.Text  = Convert.ToString(row["Telefono"]);
                    }
                    txtCodigo.Enabled = false;
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
                throw;
            }
        }