//BOTÓN BUSCAR POR ID private void BtnBuscarID_Click(object sender, System.Windows.RoutedEventArgs e) { int id; if (int.TryParse(TxtID.Text, out id) == true) { personasBusquedas.Clear(); DtgClientes.ItemsSource = null; /*Recorre el Array de personas y si encuentra el ID que escribimos * agrega la persona*/ foreach (Persona i in Contenedor.ArrayPersonas) { if (i.IdPersona.ToString() == TxtID.Text) { personasBusquedas.Add(i); } } MessageBox.Show(personasBusquedas.Count.ToString() + " clientes encontrados"); //Muestra el Array DtgClientes.ItemsSource = null; DtgClientes.ItemsSource = personasBusquedas; TxtID.Clear(); TxtBuscar.IsEnabled = true; BtnBuscar.IsEnabled = true; } else { MessageBox.Show("Verificar ID"); } }
private void CboTipoId_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { TxtID.Focus(); } }
/// <summary>Resets all TextBoxes to the default data.</summary> private void Reset() { TxtID.Text = School.CurrentStudent.Id; TxtFirstName.Text = School.CurrentStudent.FirstName; TxtLastName.Text = School.CurrentStudent.LastName; TxtID.Focus(); }
/// <summary>Clears all TextBoxes.</summary> private void Clear() { TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtID.Focus(); }
private void BtnReset_Click(object sender, EventArgs e) { TxtID.Clear(); TxtName.Clear(); ChkClose.Checked = false; ChkOpen.Checked = false; }
private void BtnCancel_Click(object sender, EventArgs e) { TxtID.Text = string.Empty; TxtPwd.Text = string.Empty; TxtID.Focus(); }
private void BtnSearchProduct_Click(object sender, EventArgs e) { if (invoice.Client != null) { if (TxtID.Text != "") { SearchProductAnswer answer = productService.Search(TxtID.Text); Product product = answer.Product; if (answer.Product != null) { TxtID.Text = product.ID; TxtName.Text = product.Name; TxtUnitMeasure.Text = product.UnitMeasure; TxtWarehouseQuantity.Text = product.Quantity.ToString(); TxtUnitValue.Text = product.UnitValue.ToString(); TxtIVA.Text = product.IVA.ToString(); TxtQuantity.Text = "0"; TxtDiscount.Text = "0"; } MessageBox.Show(answer.Message); } else { MessageBox.Show("Debe ingrasar un codigo de producto para realizar la busqueda!"); TxtID.Focus(); } } else { MessageBox.Show("Primero debe agragarun cliente a la factura!"); } }
private void InitControls() { TxtID.Text = TxtAuthor.Text = string.Empty; TxtISBN.Text = TxtNames.Text = TxtPrice.Text = string.Empty; CboDivision.SelectedIndex = 0; //선택 TxtID.Focus(); TxtID.ReadOnly = true; DtpReleaseDate.CustomFormat = "yyyy-MM-dd"; DtpReleaseDate.Format = DateTimePickerFormat.Custom; DtpReleaseDate.Value = DateTime.Now; myMode = BaseMode.NONE; ////콤보 박스 데이터 바인딩 //Dictionary<string, string> dic = new Dictionary<string, string>(); //dic.Add("선택", "00"); //dic.Add("서울특별시", "11");//key value //dic.Add("부산광역시", "21"); //dic.Add("대구광역시", "22"); //dic.Add("인천광역시", "23"); //dic.Add("광주광역시", "24"); //dic.Add("대전광역시", "25"); //CboDivision.DataSource = new BindingSource(dic,null); //폼의 데이터 소스 캡슐화 //CboDivision.DisplayMember = "key"; //CboDivision.ValueMember = "Value"; }
public NewClassView() { InitializeComponent(); TxtID.Focus(); CmbCourse.ItemsSource = School.AllCourses; CmbTeacher.ItemsSource = School.AllTeachers; }
public LoadFromID(DataSet data) { InitializeComponent(); _data = data; TxtID.Focus(); }
private void BtGuardar_Click(object sender, EventArgs e) { try { MemoryStream ms = new System.IO.MemoryStream(); PBImage.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); DataBaseControl DbControl = new DataBaseControl(DataBaseControl.cPath, "ProjectDataBase.mdf"); string[] parameters = { "@id", "@nombre", "@image" }; string[] values = { TxtID.Text, TxtNombre.Text }; if (DbControl.Insertar("Insert into Maestros values (@id,@nombre,@image)", parameters, values, ms)) { MessageBox.Show(string.Format("{0} agregado", TxtNombre.Text)); TxtID.Clear(); TxtNombre.Clear(); PBImage.Image = Image.FromFile("intec.png"); Verificar(); } else { MessageBox.Show(string.Format("{0} no agregado", TxtNombre.Text)); } } catch (Exception) { MessageBox.Show("Por favor, revisar los valores agregados"); } }
public FrmPrincipal() { InitializeComponent(); TxtID.Focus(); label6.Text = "0.0"; GrillaConsultar.DataSource = PersonaService.Consutar(); }
private void LimpiarCajas() { TxtID.Text = ""; TxtNombre.Text = ""; TxtUsuarioID.Text = ""; TxtDNI.Text = ""; TxtTelefono.Text = ""; TxtID.Focus(); }
private void BtnSave_Click(object sender, EventArgs e) { Product product = MapOutProduct(); MessageBox.Show(productService.Save(product)); FillTable(); EmptyTextBoxes(); TxtID.Focus(); }
public FindForm() { InitializeComponent(); CboQ.IsAccessible = false; TxtID.Focus(); label4.Visible = CboQ.Visible = CheckButton.Visible = true; Txt.Text = "ID"; PWA.Text = "비번 답"; Find.Text = "찾기"; }
} // end method BtnAddClear_Click() /// <summary> /// To clear the add course fields /// </summary> private void AddClear() { //Clear all Add fields CBxInstitution.ResetText(); TxtID.Clear(); TxtDescription.Clear(); CBxGrade.SelectedIndex = -1; CBxGrade.Text = string.Empty; CBxCredits.SelectedIndex = -1; CBxCredits.Text = string.Empty; } // end method AddClear()
private void ChangePW() { TxtID.Focus(); TxtID.PasswordChar = txtA.PasswordChar = '♥'; CK = 1; TxtID.Text = txtA.Text = ""; Txt.Text = "새 비번"; PWA.Text = "새 비번 확인"; label4.Visible = CboQ.Visible = CheckButton.Visible = false; Find.Text = "비번 바꾸기"; }
private void TxtContact_KeyUp(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: { TxtID.SelectAll(); TxtID.Focus(); break; } } }
} // end method TxtID_Leave() /// <summary> /// To reset all controls on the add_emp form to their defaults /// </summary> private void ResetFields() { //Clear all txtboxes and reset radioBtns to HOURLY TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtHourlyRate.Clear(); TxtMonthlySalary.Clear(); TxtCommissionRate.Clear(); TxtContractWage.Clear(); RBtnHourly.Checked = true; } // end method ResetFields()
void temizle() { TxtID.Text = ""; TxtSinav1.Text = ""; TxtSinav2.Text = ""; TxtSinav3.Text = ""; TxtProje.Text = ""; comboBox1.Text = ""; TxtOrtalama.Text = ""; TxtDurum.Text = ""; TxtID.Focus(); }
public void ClearTextBoxes() { TxtID.Clear(); TxtName.Clear(); TxtUnitMeasure.Clear(); TxtQuantity.Clear(); TxtUnitValue.Clear(); TxtIVA.Clear(); TxtWarehouseQuantity.Clear(); TxtDiscount.Clear(); TxtID.Focus(); }
private void BtnTemizle_Click(object sender, EventArgs e) { TxtYil.Clear(); TxtAy.Clear(); TxtTarih.Clear(); TxtFirma.Clear(); TxtSube.Clear(); TxtTutar1.Clear(); TxtTutar2.Clear(); TxtTtutar3.Clear(); TxtID.Clear(); TxtYil.Focus(); }
private void BtnCancel_Click(object sender, EventArgs e) { TxtID.Text = string.Empty; TxtNickName.Text = string.Empty; TxtPwd.Text = string.Empty; TxtPwdConfirm.Text = string.Empty; TxtMailAddress.Text = string.Empty; TxtVerticationCode.Text = string.Empty; CmbPwdQuestion.Text = string.Empty; TxtPwdAnswer.Text = string.Empty; TxtID.Focus(); }
private void FrmSinavNotlar_Load(object sender, EventArgs e) { TxtID.Focus(); baglanti.Open(); SqlCommand komut = new SqlCommand("Select*From TBLDERSLER", baglanti); SqlDataAdapter da = new SqlDataAdapter(komut); DataTable dt = new DataTable(); da.Fill(dt); comboBox1.DisplayMember = "DERSAD"; comboBox1.ValueMember = "DERSID"; comboBox1.DataSource = dt; baglanti.Close(); }
/// <summary>Clears all TextBoxes.</summary> private void Clear() { TxtID.Clear(); CmbCourse.SelectedIndex = -1; CmbTeacher.SelectedIndex = -1; TxtDaily.Clear(); TxtHomework.Clear(); TxtProject.Clear(); TxtQuiz.Clear(); TxtReport.Clear(); TxtTest.Clear(); TxtStartTime.Text = "9:00 AM"; TxtEndTime.Text = "9:50 AM"; TxtID.Focus(); TxtError.Visibility = Visibility.Collapsed; }
private void BtnEditar_Click(object sender, EventArgs e) { if (DGV.SelectedRows.Count > 0) { Editar = true; TxtID.Text = DGV.CurrentRow.Cells[0].Value.ToString(); TxtNombre.Text = DGV.CurrentRow.Cells[1].Value.ToString(); TxtUsuarioID.Text = DGV.CurrentRow.Cells[2].Value.ToString(); TxtDNI.Text = DGV.CurrentRow.Cells[3].Value.ToString(); TxtTelefono.Text = DGV.CurrentRow.Cells[4].Value.ToString(); TxtID.Focus(); } else { MensajeError("Seleccione una fila primero."); } }
//验证是否为空 private bool ValidateInput() { bool isOk = true; if (TxtID.Text == "") { TxtID.BackColor = Color.Red; TxtID.Focus(); isOk = false; } if (Txtname.Text == "") { Txtname.BackColor = Color.Red; Txtname.Focus(); isOk = false; } if (Txtpwd.Text == "") { Txtpwd.BackColor = Color.Red; Txtpwd.Focus(); isOk = false; } if (txtAddress.Text == "") { txtAddress.BackColor = Color.Red; txtAddress.Focus(); isOk = false; } if (TxtpaperID.Text == "") { TxtpaperID.BackColor = Color.Red; TxtpaperID.Focus(); isOk = false; } if (TxtcontactTel.Text == "") { TxtcontactTel.BackColor = Color.Red; TxtcontactTel.Focus(); isOk = false; } return(isOk); //返回结果 }
/// <summary> /// actually clears each textbox in the form /// </summary> private void ClearNewEmpForm() { EpForm.Clear(); TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtAddress.Clear(); TxtCity.Clear(); CBxState.SelectedIndex = -1; CBxEmpType.SelectedIndex = -1; TxtZip.Clear(); TxtHireDate.Clear(); CBxMarriageStatus.SelectedIndex = -1; TxtDept.Clear(); TxtJobTitle.Clear(); LblAfterSubmitMsg.Text = ""; TxtPayAmount.Visible = false; LblPayAmount.Visible = false; LblSecondInput.Visible = false; TxtSecondInput.Visible = false; }
private void BtnAdd_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TxtTitle.Text) && !string.IsNullOrEmpty(TxtID.Text) && comboBoxCredits.Text != null && comboBoxDepartments.Text != null && comboBoxInstructors.Text != null) { using (var db = new SchoolEntities()) { // converting id text to number Int32.TryParse(TxtID.Text, out Int32 ID); // converting department name to department id var deptID = from o in db.Department where o.Name.Equals(comboBoxDepartments.SelectedItem.ToString()) select o.DepartmentID; Int32.TryParse(deptID.First().ToString(), out Int32 finalDeptID); // converting credits from combobox selection to number Int32.TryParse(comboBoxCredits.SelectedItem.ToString(), out Int32 credits); var course = new Course { CourseID = ID, Title = TxtTitle.Text, Credits = credits, DepartmentID = finalDeptID }; db.Course.Add(course); // course instructor part // missing from model (?) //var courseInstructor = db. db.SaveChanges(); dataGridView1.DataSource = db.Course.ToList(); } TxtID.ResetText(); TxtTitle.ResetText(); comboBoxCredits.SelectedItem = null; comboBoxDepartments.SelectedItem = null; comboBoxInstructors.SelectedItem = null; } }
private void CHECK_ID() { string strQuery = "SELECT id FROM member " + //반드시 뒤에 SpaceBar를 넣어줘야됨(안넣으면 userTBLWHERE로 붙어져서 Syntax Error나옴) " WHERE id = @id "; //@userID로 사용안하고 직접적 ID(TxtUserID)를 바로 넣으면 SQL Injection으로 해킹위험이 나옴 try { using (MySqlConnection conn = new MySqlConnection(strConnString)) { conn.Open(); //MetroMessageBox.Show(this, $"DB접속성공!!"); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = strQuery; MySqlParameter paramUserId = new MySqlParameter("@id", MySqlDbType.VarChar, 45); cmd.Parameters.Add(paramUserId); paramUserId.Value = TxtID.Text.Trim(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); if (reader.HasRows) { MessageBox.Show("등록아이디가 있습니다."); CboQ.Focus(); CboQ.IsAccessible = true; } else { MessageBox.Show("없는 아이디 입니다."); TxtID.Text = null; TxtID.Focus(); } } } catch (Exception e) { MessageBox.Show(e.Message); } }