private void Entrega_Click(object sender, EventArgs e) { try { if (((VentaAEntregar)sender).Mov == "ValeEntrega") { string valeid = ((VentaAEntregar)sender).ID; InvConsultas.ValeEntrega_Entrega(Lugar, valeid.ToString()); if (this.fpContenedor.Controls["Vale" + valeid] != null) { this.fpContenedor.Controls["Vale" + valeid].Dispose(); this.Vales.Remove(valeid.ToString()); } txtID.Text = "V0000001"; txtID.ForeColor = Color.Silver; txtID.Focus(); } else { EntregaDeMercancia em = new EntregaDeMercancia(); em.ID = ((VentaAEntregar)sender).ID.ToString(); em.Modulo = "VTAS"; em.ModuloClave = "V"; em.Lugar = this.Lugar; if (em.ShowDialog() == DialogResult.OK) { if (this.fpContenedor.Controls[em.ID] != null) { this.fpContenedor.Controls[em.ID].Dispose(); this.IDs.Remove(em.ID); } txtID.Text = "V0000001"; txtID.ForeColor = Color.Silver; txtID.Focus(); } } } catch (Exception ex) { MessageBox.Show("Ocurrio el siguiente problema: " + ex.Message, "Entrega de Mercancia", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void txtID_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtID.Text == "") { MessageBox.Show("Debe de indicar el Id del movimiento", "Entrega de Mercancia", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EntregaDeMercancia em = new EntregaDeMercancia(); em.ID = txtID.Text;//.Substring(1); if (txtID.Text.Contains("I") || txtID.Text.Contains("i")) { em.Modulo = "INV"; em.ModuloClave = "I"; em.Lugar = this.Lugar; } else { em.Modulo = "VTAS"; em.ModuloClave = "V"; em.Lugar = this.Lugar; } if (em.ShowDialog() == DialogResult.OK) { this.IDs.Remove(em.ID); if (this.fpContenedor.Controls[em.ID] != null) { this.fpContenedor.Controls[em.ID].Dispose(); } txtID.Text = ""; txtID.Focus(); } else { txtID.Text = "V0000001"; txtID.ForeColor = Color.Silver; txtID.Focus(); } } }