private void TCampo_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { if (Anterior != null) { Anterior.TenFoco(); return; } } if (e.KeyCode == Keys.Down) { if (Siguiente != null) { Siguiente.TenFoco(); } } if (e.KeyCode == Keys.Right) { if (TCampo.SelectionStart >= TCampo.Text.Length) { TTipo.Focus(); TTipo.SelectionStart = 0; TTipo.SelectionLength = TTipo.Text.Length; } } }
public void TenFoco2() { TTipo.Focus(); TTipo.SelectionStart = 0; TTipo.SelectionLength = TTipo.Text.Length; if (OnDocumentacion != null) { OnDocumentacion(Documentacion); } }
private void BSeguir_Click(object sender, EventArgs e) { string sql = ""; string Error = ""; errorProvider1.Clear(); string mensaje = "ESTE CAMPO NO PUEDE ESTAR EN BLANCO"; if (string.IsNullOrWhiteSpace(tid.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(tid, mensaje); tid.Focus(); return; } if (string.IsNullOrWhiteSpace(tdescr.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(tdescr, mensaje); tdescr.Focus(); } if (string.IsNullOrWhiteSpace(Tcat.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(Tcat, mensaje); Tcat.Focus(); } if (string.IsNullOrWhiteSpace(TGrupo.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(TGrupo, mensaje); TGrupo.Focus(); } if (string.IsNullOrWhiteSpace(TTipo.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(TTipo, mensaje); TTipo.Focus(); } Pasa_Datos(); if (aa_modo.ToUpper().Trim() == "A") { if (CB_Estado.SelectedIndex != 0) { MessageBox.Show("NO PUEDE REGISTRAR CON ESTADO DIFERENTE DE ACTIVO"); return; } } if (!funciones.Inserta_Articulo(aa_modo, aa_Articulo, FileName, ref Error)) { MessageBox.Show(Error); return; } if (aa_modo.Trim().ToLower() == "a") { Limpia(); } else { this.DialogResult = DialogResult.OK; } }
private void button3_Click(object sender, EventArgs e) { string sql = ""; string Error = ""; errorProvider1.Clear(); string mensaje = "ESTE CAMPO NO PUEDE ESTAR EN BLANCO"; if (string.IsNullOrWhiteSpace(tid.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(tid, mensaje); tid.Focus(); return; } if (string.IsNullOrWhiteSpace(tdescr.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(tdescr, mensaje); tdescr.Focus(); } if (string.IsNullOrWhiteSpace(TTipo.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(TTipo, mensaje); TTipo.Focus(); } if (string.IsNullOrWhiteSpace(TDuracion.Text.ToString().Trim())) { MessageBox.Show(mensaje); errorProvider1.SetError(TDuracion, mensaje); TDuracion.Focus(); } if (aa_modo.ToUpper().Trim() == "A") { if (cb_estado.SelectedIndex != 0) { MessageBox.Show("NO PUEDE REGISTRAR CON ESTADO DIFERENTE DE ACTIVO"); return; } } aa_EReceta = new Clases.EReceta(); aa_EReceta.id = tid.Text; aa_EReceta.descripcion = tdescr.Text; aa_EReceta.estado = cb_estado.SelectedItem.ToString().Trim().ToUpper().Substring(0, 1); aa_EReceta.tipo = TTipo.Text; aa_EReceta.duracion = Convert.ToDecimal(TDuracion.Text.ToString()); aa_EReceta.porcion = int.Parse(TPorcion.Text.ToString()); if (aa_modo.ToString().Trim().ToUpper() != "A") { aa_EReceta.foto = ii_foto; } if (!funciones.Inserta_Receta(aa_modo, aa_EReceta, FileName, ref Error)) { MessageBox.Show(Error); return; } if (aa_modo.Trim().ToLower() == "a") { Limpia(); } else { this.DialogResult = DialogResult.OK; } }