public MainWindow() { InitializeComponent(); TextBox1.SetBinding(TextBox.TextProperty, new Binding("[0]") { Source = mode.NamesList, Mode = BindingMode.OneWay }); TextBox2.SetBinding(TextBox.TextProperty, new Binding("[2]") { Source = mode.NamesList, Mode = BindingMode.OneWay }); TextBox3.SetBinding(TextBox.TextProperty, new Binding("[2].Length") { Source = mode.NamesList, Mode = BindingMode.OneWay }); TextBox4.SetBinding(TextBox.TextProperty, new Binding("[0]") { Source = mode.Ctry.Province[0].City[0].Person[0].name, Mode = BindingMode.OneWay }); TextBox5.SetBinding(TextBox.TextProperty, new Binding("[1]") { Source = mode.Ctry.Province[0].City[0].Person[0].name, Mode = BindingMode.OneWay }); TextBox6.SetBinding(TextBox.TextProperty, new Binding("[2]") { Source = mode.Ctry.Province[0].City[0].Person[0].name, Mode = BindingMode.OneWay }); }
protected void Button5_Click(object sender, EventArgs e) { OleDbConnection con = new OleDbConnection(constr); con.Open(); string cmdstr = "select number from PHONE where name = @a"; OleDbCommand com = new OleDbCommand(cmdstr, con); com.Parameters.AddWithValue("@a", TextBox4.Text.Trim()); OleDbDataReader r; r = com.ExecuteReader(); if (r.Read()) { Label7.Visible = true; //OleDbConnection con = new OleDbConnection(constr); string cmdstr1 = "delete from PHONE where NAME=@a"; OleDbCommand com1 = new OleDbCommand(cmdstr1, con); //con.Open(); com1.Parameters.AddWithValue("@a", TextBox4.Text); com1.ExecuteNonQuery(); con.Close(); Label7.Visible = true; Label7.Text = "Contact Deleted Successfully...!"; TextBox4.Text = String.Empty; TextBox4.Focus(); } else { Label7.Visible = true; Label7.Text = "Contact Not Found...!"; } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { string date = System.DateTime.Today.Date.ToString("dd"); string month = System.DateTime.Today.Month.ToString(); string year = System.DateTime.Today.Year.ToString(); string month23 = DateTime.Now.Month.ToString(); if (Convert.ToInt32(month23) <= 9) { string mm = "0" + month23; ddlmonth.Items.FindByText(mm).Selected = true; } else { ddlmonth.Items.FindByText(month23).Selected = true; } ddldate.Items.FindByText(date).Selected = true; ddlyear.Items.FindByText(year).Selected = true; TextBox4.Focus(); f1(); } }
private void temizle() { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); }
protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { try { int id = Convert.ToInt32(TextBox1.Text); producto actualizar = conectar.producto.FirstOrDefault (a => a.id_producto == id); if (actualizar != null) { actualizar.nombre_producto = Convert.ToString(TextBox2.Text); actualizar.descripcion_producto = Convert.ToString(TextBox3.Text); actualizar.existencia_producto = Convert.ToString(TextBox4.Text); conectar.SaveChanges(); limpiar(); Label9.Text = "registro actualizado"; GridView1.DataBind(); TextBox4.Focus(); } else { Label9.Text = "la identificacion no existe"; } } catch (Exception ex) { Label10.Text = "No se ha podido modificar el registro...\n" + ex.Message; } }
protected void Button3_Click(object sender, EventArgs e) { if (TextBox1.Text == "") { Response.Write("<script>alert('Please insert Name.');</script>"); TextBox1.Focus(); } else if (TextBox2.Text == "") { Response.Write("<script>alert('Please insert Contact Number');</script>"); TextBox2.Focus(); } else if (TextBox3.Text == "") { Response.Write("<script>alert('Please insert E-mail');</script>"); TextBox3.Focus(); } else if (TextBox4.Text == "") { Response.Write("<script>alert('Please insert Confirm E-mail');</script>"); TextBox4.Focus(); } else if (TextBox3.Text != TextBox4.Text) { Response.Write("<script>alert('Email is not same with Confirm Email. Please insert again.');</script>"); TextBox4.Focus(); } else { Response.Write("<script>alert('Payment is complete.');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { Page.Title = "Insert"; Page.Form.Method = "post"; Label1.Text = "Add a receipt "; Label2.Text = "Name"; Label3.Text = "Company"; Label4.Text = "Number"; Label5.Text = "Arrears"; Label6.Text = "Suma"; TextBox2.Focus(); TextBox3.Focus(); TextBox4.Focus(); TextBox5.Focus(); TextBox6.Focus(); Button1.Text = "Ready"; Button1.Width = 125; TextBox2.Width = 140; RequiredFieldValidator2.ControlToValidate = "TextBox2"; RequiredFieldValidator2.ErrorMessage = "* fill Name"; RequiredFieldValidator3.ControlToValidate = "TextBox3"; RequiredFieldValidator3.ErrorMessage = "* fill Company "; RequiredFieldValidator4.ControlToValidate = "TextBox4"; RequiredFieldValidator4.ErrorMessage = "* fill Number"; RequiredFieldValidator5.ControlToValidate = "TextBox5"; RequiredFieldValidator5.ErrorMessage = "* fill Arrears"; RequiredFieldValidator6.ControlToValidate = "TextBox6"; RequiredFieldValidator6.ErrorMessage = "* fill Suma"; }
protected void Button3_Click(object sender, EventArgs e) { try { entity.CategoryID = int.Parse(TextBox3.Text); entity.SupplierID = int.Parse(Session["id"].ToString()); entity.CategoryName = TextBox4.Text; if (BL.Edit(entity) > 0) { lblMsg0.Text = "Data Was Updated Successfully ...!"; TextBox4.Text = ""; Button3.Enabled = false; Button5.Enabled = false; TextBox4.Focus(); } else { lblMsg0.Text = "Data Was not Updated Successfully ...!"; } } catch (Exception ex) { lblMsg0.Text = ex.Message; } finally { fillGrid(); } }
private void TextBox3_PreviewTextInput(object sender, TextCompositionEventArgs e) { char c = Convert.ToChar(e.Text); if (Char.IsControl(c)) { TextBox4.Focus(); return; } int a = TextBox3.Text.ToCharArray().Where(d => d == '@').Count(); if (c == '@') { if (a == 0) { e.Handled = false; } else { e.Handled = true; } return; } e.Handled = false; }
protected void ImageButton4_Click(object sender, ImageClickEventArgs e) { try { int id = Convert.ToInt32(TextBox1.Text); producto Eliminar = conectar.producto.FirstOrDefault (a => a.id_producto == id); if (Eliminar != null) { conectar.DeleteObject(Eliminar); conectar.SaveChanges(); limpiar(); //Label1.Text = "registro eliminado"; GridView1.DataBind(); TextBox4.Focus(); Label9.Text = "Registro eliminado correctamente"; } else { Label10.Text = "la identificacion no existe"; } } catch (Exception ex) { Label9.Text = "No se ha eliminado...\n" + ex.Message; } }
private void Button2_Click(object sender, EventArgs e) { DialogResult g; g = MessageBox.Show(DataGridView1.CurrentRow.Cells[0].Value + " nolu Barkod Kodu silinecek. Emin misiniz?", "DİKKAT", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); if (g == DialogResult.Yes) { OleDbCommand cmd = new OleDbCommand("DELETE FROM BARKOD WHERE BarkodNo=" + Convert.ToInt32(DataGridView1.CurrentRow.Cells[0].Value), bag); cmd.ExecuteNonQuery(); MessageBox.Show("Barkod veritabanından silindi.", "İŞLEM TAMAM", MessageBoxButtons.OK, MessageBoxIcon.Information); DataGridView1.Rows.Clear(); TextBox3.Clear(); TextBox4.Clear(); cmd = new OleDbCommand("SELECT * FROM BARKOD ORDER BY BarkodNo ASC", bag); OleDbDataReader oku = cmd.ExecuteReader(); while (oku.Read()) { DataGridView1.Rows.Add(oku[0].ToString(), oku[1].ToString()); } oku.Close(); } else { return; } }
private void Button1_Click(object sender, EventArgs e) { baglanti(); if (TextBox3.Text == "" || TextBox4.Text == "") { MessageBox.Show("Barkod Numarası ve Tanım alanlarını doldurunuz.", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } OleDbCommand cmd = new OleDbCommand("INSERT INTO BARKOD(BarkodNo,Tanim,StokKodu) Values('" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox1.Text + "')", bag); cmd.ExecuteNonQuery(); MessageBox.Show("Veritabanına Kaydedildi.", "İŞLEM TAMAM", MessageBoxButtons.OK, MessageBoxIcon.Information); DataGridView1.Rows.Clear(); TextBox3.Clear(); TextBox4.Clear(); cmd = new OleDbCommand("SELECT * FROM BARKOD ORDER BY BarkodNo ASC", bag); OleDbDataReader oku = cmd.ExecuteReader(); while (oku.Read()) { DataGridView1.Rows.Add(oku[0].ToString(), oku[1].ToString()); } oku.Close(); }
protected void TextBox3_TextChanged(object sender, EventArgs e) { try { ConnectDB cdb = new ConnectDB(); cdb.connectDataBase(); SqlConnection con = cdb.connect; con.Open(); SqlCommand com = cdb.command; com.CommandText = "SELECT user_id from [dbo].[user] where email =@email and role_name=@role_name"; com.Parameters.AddWithValue("@email", TextBox3.Text); com.Parameters.AddWithValue("@role_name", DropDownList1.SelectedItem.Text); SqlDataReader rdr; rdr = com.ExecuteReader(); if (rdr.Read()) { Label8.Visible = true; TextBox3.Text = ""; TextBox3.Focus(); } else { Label8.Visible = false; TextBox4.Focus(); } con.Close(); } catch (Exception exc) { Response.Redirect("Error.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox5.Text.Equals(TextBox4.Text) == false) { Label1.Text = "⚠ Passwords don't match..."; TextBox4.Text = ""; TextBox5.Text = ""; TextBox4.Focus(); return; } if (checkEmailAvailability() == false) { Label1.Text = "⚠ E-mail already taken..."; TextBox3.Text = ""; TextBox3.Focus(); return; } openConnection(); cmd.CommandText = "INSERT into UserInfo (FirstName,LastName,email,password) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')"; if (cmd.ExecuteNonQuery() >= 1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your account has been created.');window.location ='Login.aspx';", true); //Response.Redirect("Login.aspx"); } else { Label1.Text = "⚠ Cannot Signup"; } con.Close(); }
protected void Button3_Click(object sender, EventArgs e) { string sBooks = null; sBooks = TextBox4.Text.Trim(); // CHECK IF TEXTBOX HAS ANY VALUE BEFORE ADDING. if (!string.IsNullOrEmpty(sBooks.Trim())) { // IN-ADDITION, CHECK IF THE ENTERED VALUE (BOOK) ALREADY EXISTS IN THE LIST, // TO AVOID DUPLICATE ENTRIES. if ((DropDownList1.Items.FindByText(sBooks) == null)) { DropDownList1.Items.Add(new ListItem(sBooks, sBooks)); TextBox4.Text = ""; int iBooksCount = DropDownList1.Items.Count - 1; //lblMessage.Text = "A new book added to the list. <br />" + // "Now you have <b>" + iBooksCount + "</b> item(s) in the list."; } else { //lblMessage.Text = "Item <b>" + sBooks.Trim() + // "</b> already exists in the list. <br />" + "Add another book."; } TextBox4.Text = ""; TextBox4.Focus(); } }
//private void TextBox2_Leave(object sender, EventArgs e) //{ // Check_AlarmStatus(); // TextBox2.SelectAll(); //} //private void TextBox3_Leave(object sender, EventArgs e) //{ // Check_AlarmStatus(); // TextBox3.SelectAll(); //} //private void TextBox4_Leave(object sender, EventArgs e) //{ // Check_AlarmStatus(); // TextBox4.SelectAll(); //} private void Check_AlarmStatus() { try { if (TextBox1.BackColor != Color.LightGray) { if ((TextBox1.Text.Substring(0, 1).ToUpper() != "I") && (TextBox1.Text.Substring(0, 1).ToUpper() != "O")) { MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !"); TextBox1.ContextMenuStrip = contextMenuStrip2; TextBox1.Focus(); TextBox1.ContextMenuStrip.Show(TextBox1, new Point(0, TextBox1.Height)); //, ToolStripDropDownDirection.BelowRight); return; } } if (TextBox4.BackColor != Color.LightGray) { if ((TextBox4.Text.Substring(0, 1).ToUpper() != "I") && (TextBox4.Text.Substring(0, 1).ToUpper() != "O")) { MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !"); TextBox4.ContextMenuStrip = contextMenuStrip2; TextBox4.Focus(); TextBox4.ContextMenuStrip.Show(TextBox4, new Point(0, TextBox4.Height)); //, ToolStripDropDownDirection.BelowRight); return; } } // ******************//Check Alarm Status.... A if (TextBox2.BackColor != Color.LightGray) { if (TextBox2.Text.Substring(0, 1).ToUpper() != "A") { MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !"); TextBox2.ContextMenuStrip = contextMenuStrip2; TextBox2.Focus(); TextBox2.ContextMenuStrip.Show(TextBox2, new Point(0, TextBox2.Height)); //, ToolStripDropDownDirection.BelowRight); return; } } if (TextBox3.BackColor != Color.LightGray) { if (TextBox3.Text.Substring(0, 1).ToUpper() != "A") { MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !"); TextBox3.ContextMenuStrip = contextMenuStrip2; TextBox3.Focus(); TextBox3.ContextMenuStrip.Show(TextBox3, new Point(0, TextBox2.Height)); //, ToolStripDropDownDirection.BelowRight); return; } } } catch (Exception ex) { MessageBox.Show("Check_AlarmStatus @ Error Code:-7007 " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { TextBox4.Focus(); f1(); } }
private void button9_Click(object sender, EventArgs e) { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); textBox5.Clear(); }
private void DeliteRecord_Click(object sender, RoutedEventArgs e) { AllRecords.RemoveAt(ListView1.SelectedIndex); TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); MessageBox.Show("Complite!"); }
private void TextBox4_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { TextBox4.ContextMenuStrip = contextMenuStrip1; TextBox4.Focus(); TextBox4.ContextMenuStrip.Show(TextBox4, new Point(0, TextBox4.Height)); //, ToolStripDropDownDirection.BelowRight); } }
private void limpiar() { TextBox1.Clear(); TextBox4.Clear(); textBox5.Clear(); TextBox6.Clear(); TextBox7.Clear(); TextBox3.Clear(); }
private void Button3_Click(object sender, EventArgs e) { TextBox2.Clear(); ComboBox1.Text = ""; TextBox4.Clear(); TextBox1.Clear(); TextBox3.Clear(); TextBox5.Clear(); textBox6.Clear(); TextBox2.Focus(); }
public void ClearTextBoxes() { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); TextBox5.Clear(); TextBox6.Clear(); TextBox7.Clear(); TextBox8.Clear(); TextBoxID.Clear(); }
private void TextBox4_Leave(object sender, EventArgs e) { if (TextBox4.Text == "") { EP.SetError(TextBox4, "Fill the Max RPM first"); TextBox4.Focus(); } else { EP.Clear(); } }
protected void create_click(object sender, EventArgs e) { String newName, newAdd, newMail, newAnswer, newPass; newName = TextBox1.Text; newAdd = TextBox2.Text; newMail = TextBox3.Text; if (TextBox4.Text == TextBox5.Text) { newPass = TextBox4.Text; } else { errorMessage.Style.Add("visibility", "visible"); errorMessage.InnerHtml = "Passwords do not match"; TextBox4.Text = ""; TextBox5.Text = ""; TextBox4.Focus(); return; } newAnswer = TextBox6.Text; if (newName == "" || newAdd == "" || newMail == "" || newAnswer == "" || newPass == "") { errorMessage.Style.Add("visibility", "visible"); errorMessage.InnerHtml = "Please insert all values"; return; } cmd.CommandText = "insert into users values('" + newMail + "','" + newPass + "','" + newName + "','" + newAdd + "','" + newAnswer + "')"; try { cmd.ExecuteNonQuery(); Response.Redirect("LoginPage.aspx"); } catch (SqlException ex) { if (ex.Number == 2627) { errorMessage.Style.Add("visibility", "visible"); errorMessage.InnerHtml = "Email already in use."; } else { Response.Write(ex.ToString()); } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { bool flag = true; string confrim_value = Request.Form["Confirm_Value"]; if ((TextBox4.Text == "")) { Response.Write("<script>alert('Problem Cannot be Blank')</script>"); TextBox4.Focus(); flag = false; } if ((TextBox6.Text == "")) { Response.Write("<script>alert('Received Date Cannot be Blank')</script>"); TextBox6.Focus(); flag = false; } if ((confrim_value == "YES") && (flag == true)) { int Ref_No = Int32.Parse(TextBox1.Text); string Rec_Date = Calendar1.SelectedDate.ToShortDateString(); string Prob_Desc = TextBox4.Text; string Type = DropDownList2.SelectedItem.Text; string Remarks = TextBox3.Text; string Req_Name = TextBox2.Text; string Com_Type = DropDownList3.SelectedValue.ToString(); bl c = new bl(); if (c.addsrvreq(Ref_No, Rec_Date, Req_Name, Prob_Desc, Type, Com_Type, Remarks)) { Response.Write("<script> alert('Record Updated Successfully')</script>"); Response.Redirect("WebForm1.aspx"); } else { Response.Write("<script> alert('Update Unsuccessful')</script>"); } } if (flag == false) { Response.Write("<script> alert('Update Unsuccessful')</script>"); } }
private void ChangeRecord_Click(object sender, RoutedEventArgs e) { if (Check()) { AllRecords.RemoveAt(ListView1.SelectedIndex); AllRecords.Add(new Record(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text)); TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); MessageBox.Show("Complite!"); } }
/*private void Button_Click_3(object sender, RoutedEventArgs e) * { * try * { * Text1.Clear(); * } * catch * { * } * }*/ private void Button_Click_4(object sender, RoutedEventArgs e) { try { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); } catch { } }
private void Button2_Click(object sender, EventArgs e) { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); TextBox5.Clear(); MessageBox.Show("Se ha eliminado el reporte.", "Importante", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox4.Text == TextBox5.Text && TextBox4.Text != "") { Clases.ValoresGlobales VGlobal = new Clases.ValoresGlobales(); DataSet DatRegistros = new DataSet(); string Sentencia; Sentencia = "SELECT * FROM usuarios WHERE usuario='" + TextBox3.Text.Trim() + "';"; DatRegistros = VGlobal.BDatos.Lectura(Sentencia); try { if (DatRegistros != null) { if (DatRegistros.Tables[0].Rows.Count > 0) { this.TextBox3.Text = ""; this.TextBox3.Focus(); ////usuario ya exite ScriptManager.RegisterStartupScript(this, GetType(), "onLoad", "error();", true); } else { //////// usuario no exite Sentencia = "INSERT INTO `usuarios`( `usuario`, `password`, `id_tipo`) VALUES ('" + TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "',2)"; string checar = VGlobal.BDatos.Escritura(Sentencia); if (checar.Equals("Ok")) { ScriptManager.RegisterStartupScript(this, GetType(), "onLoad", " bien();", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "onLoad", "erroralregistroUsu();", true); } } } } catch (Exception) { //// error egeneral throw; } } else { //// erorer de password TextBox4.Text = ""; TextBox5.Text = ""; TextBox4.Focus(); ScriptManager.RegisterStartupScript(this, GetType(), "onLoad", "errorPassword();", true); } }