//buscar private void btn_Buscar_Click(object sender, EventArgs e) { if (this.txt_IdServicio.Text == "") { MessageBox.Show("El id está vacío \n Ingrese un valor para buscar..", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); return; } else { tabla = this.servi.Buscar_x_Id(this.txt_IdServicio.Text); if (tabla.Rows.Count == 0) { MessageBox.Show("No se ha encontrado ningún Servicio con ese Id", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); this.blanquear_objetos(); return; } this.txt_Descripcion.Text = tabla.Rows[0]["descripcion_servicio"].ToString(); this.txt_ID_tipo.Text = tabla.Rows[0]["id_tipo_servicio"].ToString(); //LASOLUCION MAGICA FUE ESTA //ahora hace una consulta buscando por el id que esta en el txt int id = int.Parse(txt_ID_tipo.Text); //convierto a int tabla = tipo.Buscar_tipoServicio_X_Id(id); //realiza la consulta this.cbo_tipoServicio.Text = tabla.Rows[0]["desc_tipo_servicio"].ToString(); this.btn_Buscar_Logo.Enabled = false; this.btn_Limpiar.Enabled = true; this.btn_Actualizar.Enabled = true; this.btn_Eliminar.Enabled = true; this.btn_Guardar.Enabled = false; this.txt_IdServicio.Enabled = false; this.txt_IdServicio.Focus(); //if (this.btn_Buscar_Logo.Visible == true) //{ // this.txt_Descripcion.Enabled = false; // this.txt_IdServicio.Enabled = false; // this.btn_Buscar_Logo.Visible= false; //} } }
private void btn_Buscar_Click(object sender, EventArgs e) { if (this.txt_ID_tipoServicio.Text == "") { MessageBox.Show("El id está vacío \n Ingrese un valor para buscar..", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); return; } else { int id = int.Parse(txt_ID_tipoServicio.Text); tabla = tipo.Buscar_tipoServicio_X_Id(id); if (tabla.Rows.Count == 0) { MessageBox.Show("No se ha encontrado ningún tipo de servicio con ese Id", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); this.blanquear_objetos(); return; } this.txt_descripcion.Text = tabla.Rows[0]["desc_tipo_servicio"].ToString(); this.txt_costo.Text = tabla.Rows[0]["costo"].ToString(); this.btn_Buscar_Logo.Enabled = false; this.btn_Limpiar.Enabled = true; this.btn_Actualizar.Enabled = true; this.btn_Eliminar.Enabled = true; this.btn_Guardar.Enabled = false; this.txt_ID_tipoServicio.Enabled = true; this.txt_ID_tipoServicio.Focus(); } }