protected void btsua_Click(object sender, EventArgs e) { if (TextBox1.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập Phòng Ban!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBox1.Focus(); return; } if (TextBox2.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập Tên Phòng Ban!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBox2.Focus(); return; } if (MessageBox.Show("Bạn có muốn sửa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SqlConnection con = new SqlConnection("Data Source=ADMIN\\VIEWSOINC;Initial Catalog=Gioithieutintuc;Integrated Security=True"); SqlCommand cmd = new SqlCommand("update ChuDe set ChuDeID='" + TextBox1.Text + "',TenCD='" + TextBox2.Text + "'where ChuDeID='" + TextBox1.Text + "'", con); con.Open(); // mo ket noi cmd.ExecuteNonQuery(); // thuc thi con.Close(); Loadbang(); txbhienthi.Text = "Bạn đã sửa thành công!"; } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == "") { Response.Write("<script>alert('请输入第一个加数!')</script>"); TextBox1.Focus(); } else if (TextBox2.Text == "") { Response.Write("<script>alert('请输入第二个加数!')</script>"); TextBox2.Focus(); } else { try { int a = Convert.ToInt16(TextBox1.Text); int b = Convert.ToInt16(TextBox2.Text); Label2.Text = (a + b).ToString(); } catch (Exception ex) { Response.Write("<script>alert('输入有误!!!')</script>"); } } }
private void Button1_Click(object sender, RoutedEventArgs e) { int counter = 0; string word = null; if (string.IsNullOrWhiteSpace(TextBox1.Text)) { TextBlock1.Text = "Molim vas unesite tekst"; return; } string[] words = TextBox2.Text.Split(" ".ToCharArray()); foreach (var sentence in words) { if (!string.IsNullOrEmpty(sentence) && (TextBox1.Text.Contains(sentence))) { counter++; word += " " + sentence; } } TextBox1.Clear(); TextBox2.Clear(); TextBox1.Focus(); TextBlock1.Text = $"The same word's are {word} \n and their number is: {counter} "; }
protected void Button1_Click(object sender, EventArgs e) { try { entity.CategoryID = int.Parse(TextBox1.Text); entity.SupplierID = int.Parse(Session["id"].ToString()); entity.CategoryName = TextBox2.Text; if (BL.Add(entity) > 0) { lblMsg.Text = "Data Was Saved Successfully ...!"; TextBox2.Text = ""; TextBox2.Focus(); } else { lblMsg.Text = "Data Was not Saved Successfully ...!"; } } catch (Exception ex) { lblMsg.Text = ex.Message; } finally { GetID(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { TextBox2.Focus(); //is used to keep the cursor within the textbox field } }
protected void Page_Load(object sender, EventArgs e) { sql = "Select * From receipt"; NpgsqlDataAdapter dat = new NpgsqlDataAdapter(sql, WebForm3.conn); DataSet ds = new DataSet(); dat.Fill(ds); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); dat.Dispose(); Label1.Text = " Enter name of user and number of receipt which you whant to edit, please"; Label2.Text = "Name: "; TextBox2.Focus(); RequiredFieldValidator2.ControlToValidate = "TextBox2"; RequiredFieldValidator2.ErrorMessage = "* fill Name"; Label3.Text = "Number: "; TextBox3.Focus(); RequiredFieldValidator3.ControlToValidate = "TextBox3"; RequiredFieldValidator3.ErrorMessage = "* fill Number"; Button1.Text = "Edit"; Button2.Visible = false; Label4.Visible = Label5.Visible = Label6.Visible = Label7.Visible = Label8.Visible = Label9.Visible = false; TextBox5.Visible = TextBox6.Visible = TextBox7.Visible = TextBox8.Visible = TextBox9.Visible = false; RequiredFieldValidator5.Visible = RequiredFieldValidator6.Visible = RequiredFieldValidator7.Visible = RequiredFieldValidator8.Visible = RequiredFieldValidator9.Visible = false; }
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"; }
private void temizle() { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TextBox2.Focus(); } }
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) { if ((Request.QueryString["Acao"] != null) && (Request.QueryString["Acao"].ToString() == "Sair")) { if (Session["Grupo"] != null) { Session["Grupo"] = null; } if (Session["CodigoUsuario"] != null) { Session["CodigoUsuario"] = null; } if (Session["Usuario"] != null) { Session["Usuario"] = null; } Response.Redirect("~/Login.aspx"); } if (TextBox1.Text.Trim() == String.Empty) { TextBox1.Focus(); } else { TextBox2.Focus(); } }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox1.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập Tác Giả!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBox1.Focus(); return; } if (TextBox2.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập Tên Tác Giả!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBox2.Focus(); return; } if (TextBox3.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập Email!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBox3.Focus(); return; } if (MessageBox.Show("Bạn có muốn Xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SqlConnection con = new SqlConnection("Data Source=ADMIN\\VIEWSOINC;Initial Catalog=Gioithieutintuc;Integrated Security=True"); SqlCommand cmd = new SqlCommand("delete from TacGia where TacGiaID='" + TextBox1.Text + "'", con); con.Open(); // mo ket noi cmd.ExecuteNonQuery(); // thuc thi con.Close(); Loadbang(); txbhienthi.Text = "Bạn đã xoá thành công!"; } }
private void button2_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Data Source=ANDREW-PC\\SQLEXPRESS;Integrated Security=True"); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = @"SELECT [fname], [email], [addr] FROM [BookGeeks].[dbo].[users] WHERE [Uname]='" + username.Text + "'AND [password]='" + TextBox2.Text + "'"; SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { Fname = rdr[0].ToString(); email = rdr[1].ToString(); address = rdr[2].ToString(); this.Hide(); MainMenu m = new MainMenu(Fname, email, address); Details d = new Details(Fname); m.Show(); } else { MessageBox.Show("Incorrect username or password,Please Try again!"); } TextBox2.Clear(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (!File.Exists("Märkmed.xml")) { MessageBox.Show("Fail puudub"); } else { string xmlfilepath = @"D:\programs\Visual Studio 2017\XML Märkmed\MärkmeteHarjutus\MärkmeteHarjutus\bin\Debug\Märkmed.xml"; XmlDocument doc = new XmlDocument(); doc.Load(xmlfilepath); XmlNode node1 = doc.SelectSingleNode("/Märkmik/Märge/Pealkiri"); node1.InnerText = TextBox1.Text; XmlNode node2 = doc.SelectSingleNode("/Märkmik/Märge/Sisu"); node2.InnerText = TextBox2.Text; XmlNode node3 = doc.SelectSingleNode("/Märkmik/Märge/Pealkiri"); TextBox3.Text = node3.InnerText; XmlNode node4 = doc.SelectSingleNode("/Märkmik/Märge/Sisu"); TextBox4.Text = node4.InnerText; doc.Save("Märkmed.xml"); MessageBox.Show("Märge Lisatud"); //TextBox4.Text = File.ReadAllText("Märkmed.xml"); TextBox1.Clear(); TextBox2.Clear(); } }
protected void TextBox2_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 user_id =@user_id UNION SELECT user_id from [dbo].[temp_user] where user_id =@user_id"; com.Parameters.AddWithValue("@user_id", TextBox2.Text); SqlDataReader rdr; rdr = com.ExecuteReader(); if (rdr.Read()) { TextBox2.Text = ""; Label7.Visible = true; TextBox2.Focus(); } else { Label7.Visible = false; TextBox3.Focus(); } rdr.Close(); con.Close(); } catch (Exception exc) { Response.Redirect("Error.aspx"); } }
private void TextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TextBox2.Focus(); } }
private void Button2_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(TextBox1.Text)) { String path = TextBox1.Text; System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "bin_hex.cmd"; startInfo.Arguments = "\"" + path + "\""; process.StartInfo = startInfo; process.Start(); filename = path.Substring(0, path.LastIndexOf('.')); abc = filename + ".hex"; if (File.Exists(abc)) { using (StreamReader sr = new StreamReader(abc)) { String line; while ((line = sr.ReadLine()) != null) { TextBox2.AppendText(line + "\n"); } } File.Delete(abc); } } else { MessageBox.Show("Please select BIN file!"); } }
private void Button2_Click(object sender, EventArgs e) { if (c.cnn.State == ConnectionState.Open) { c.cnn.Close(); } c.cnn.Open(); if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "") { MessageBox.Show("Fill the form properly", "Reset", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { sqlcom = c.cnn.CreateCommand(); sqlcom.CommandText = "select * from adlogin where AdmName='" + TextBox1.Text + "' and APassword='******'"; sqldr = sqlcom.ExecuteReader(); if (sqldr.Read()) { if (c.cnn.State == ConnectionState.Open) { c.cnn.Close(); } c.cnn.Open(); sqlcom = c.cnn.CreateCommand(); sqlcom.CommandText = "update adlogin set APassword='******' where AdmName='" + TextBox1.Text + "'"; sqldr = sqlcom.ExecuteReader(); TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); } } }
private void getdanwei() { TextBox2.DataSource = data.GetDataReader("select distinct code from wfshengqing where IsChk='否' "); TextBox2.DataTextField = "code"; //TextBox2.DataValueField = "id"; TextBox2.DataBind(); }
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 Page_Load(object sender, EventArgs e) { //set default inputs TextBox2.Focus(); Page.Form.DefaultButton = Button2.UniqueID; //read and validate login if (Session["cuserval"] != null) { if (Session["cuserval"].ToString() == Readjobcookie()) { } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } Label15.Text = "<br/> hi, " + Session["pusername"] + " please choose/update your cv/resume here <br/ ><br/ >"; }
private void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == "") { MessageBox.Show("Enter User Name"); TextBox1.Focus(); return; } if (TextBox2.Text == "") { MessageBox.Show("Enter Password"); TextBox2.Focus(); return; } conn = new SqlConnection(ConnString); sql1 = "SELECT * from tbl_user where username='******'", "''").Trim() + "' and usertype='" + ComboBox1.Text + "' and password='******'"; if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmd = new SqlCommand(); SqlDataReader rs; cmd.CommandText = sql1; cmd.Connection = conn; rs = cmd.ExecuteReader(); if (rs.Read()) { if (rs["usertype"].ToString() == "STAFF") { rs.Close(); Form1 frm = new Form1(); frm.administratorToolStripMenuItem.Enabled = false; frm.employeeToolStripMenuItem.Enabled = false; frm.Show(); this.Hide(); } else { rs.Close(); Form1 frm = new Form1(); frm.Show(); this.Hide(); } } else { rs.Close(); MessageBox.Show("Invalid User Name Or Password"); TextBox1.Focus(); } if (conn.State == ConnectionState.Open) { conn.Close(); } }
//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); } }
private void TextBox2_TextChanged(object sender, TextChangedEventArgs e) //Аналогично на второй TextBox, тоже проверяем и ругаемся! { if (System.Text.RegularExpressions.Regex.IsMatch(TextBox2.Text, "[^0-9]")) { MessageBox.Show("В данном поле разрешены только цифры (╯°□°)╯┻━┻"); TextBox2.Clear(); } }
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e) { if (e.EventArgument == "TextBox1_ENTER") { TextBox2.Text = TextBox1.Text; TextBox2.Focus(true); } }
private void button9_Click(object sender, EventArgs e) { TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); TextBox4.Clear(); textBox5.Clear(); }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { TextBox2.Text = Calendar1.SelectedDate.ToShortDateString(); Calendar1.Visible = !Calendar1.Visible; TextBox2.Focus(); cal(); }
private void ResetRecord() { DateTimePicker1.Value = DateTime.Now; TextBox1.Clear(); TextBox2.Clear(); TextBox3.Clear(); btnadd.Text = "Add"; DateTimePicker1.Focus(); }
private void TextBox2_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { TextBox2.ContextMenuStrip = contextMenuStrip2; TextBox2.Focus(); TextBox2.ContextMenuStrip.Show(TextBox2, new Point(0, TextBox2.Height)); //, ToolStripDropDownDirection.BelowRight); } }
protected override void OnLoad() { base.OnLoad(); Layer = LayerUI; MMW.FindGameComponent <BackgroundScript>().Trans(new OpenTK.Graphics.Color4(148, 212, 222, 255), 0.25); transit = new TransitControl(); transit.LocalLocation = new Vector2(MMW.ClientSize.Width * 2.0f, 0); transit.Size = new Vector2(MMW.ClientSize.Width, MMW.ClientSize.Height); transit.Target = Vector2.Zero; input = new MenuInputResolver(); var label = new Label() { Parent = transit, Alignment = ContentAlignment.TopCenter, Text = "OPTION", Font = new Font("Yu Gothic UI Light", 40.0f), LocalLocation = new Vector2(0.0f, 32.0f), }; controls.Add(label); userData = MMW.GetAsset <UserData>(); var labelName = new Label(transit, "User Name", new Vector2(200.0f, 160.0f)); labelName.Font = Control.DefaultFontB; controls.Add(labelName); var textBoxName = new TextBox2(labelName, userData.UserName, new Vector2(200.0f, 0.0f), new Vector2(300.0f, 32.0f)); textBoxName.MaxLength = 16; textBoxName.TextChanged += (s, e) => { userData.UserName = textBoxName.Text; }; controls.Add(textBoxName); var labelArchive = new Label(transit, "Display Achivement", new Vector2(200.0f, 200.0f)); labelArchive.Font = Control.DefaultFontB; controls.Add(labelArchive); var comboArchive = new ComboBox(labelArchive, new Vector2(200.0f, 0.0f), new Vector2(300.0f, 32.0f)); if (userData.Achivements.Count > 0) { comboArchive.Items = userData.Achivements.ToArray(); comboArchive.SelectedIndex = userData.ArchiveIndex; comboArchive.DisplayMember = "Name"; comboArchive.SelectedIndexChanged += (s, e) => { userData.ArchiveIndex = e; }; } else { comboArchive.Enabled = false; } controls.Add(comboArchive); }