private void txtRun_Price1_KeyPress(object sender, KeyPressEventArgs e) { Char[] ChrInStr = new Char[txtRun_Price1.Text.Length]; ChrInStr = txtRun_Price1.Text.ToCharArray(); foreach (Char ChkChr in ChrInStr) { if (ChkChr == '.') { if (!(char.IsDigit(e.KeyChar) || char.IsControl(e.KeyChar))) { e.Handled = true; } } } if (!(char.IsDigit(e.KeyChar) || char.IsControl(e.KeyChar) || (e.KeyChar == 46))) { e.Handled = true; } }
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Back) { m_Amount = Convert.ToDouble(textBox1.Text); m_Amount = ((m_Amount * 100) - ((m_Amount * 100) % 10)) / 1000; textBox1.Text = m_Amount.ToString("#,##0.00 ;#,##0.00-"); textBox1.SelectionStart = textBox1.SelectionStart + textBox1.Text.Length; } else { e.Handled = true; if (e.KeyChar >= (char)48 && e.KeyChar <= (char)57) { if (textBox1.Text.Length > 10) { e.Handled = false; return; } m_Amount = Convert.ToDouble(textBox1.Text); m_AmountNew = Convert.ToDouble(e.KeyChar.ToString()); m_Amount = ((m_Amount * 1000) + m_AmountNew) / 100; textBox1.Text = m_Amount.ToString("#,##0.00 ;#,##0.00-"); textBox1.SelectionStart = textBox1.SelectionStart + textBox1.Text.Length; } else if (e.KeyChar == (char)8) { m_Amount = Convert.ToDouble(textBox1.Text); m_Amount = ((m_Amount * 100) - ((m_Amount * 100) % 10)) / 1000; textBox1.Text = m_Amount.ToString("#,##0.00 ;#,##0.00-"); textBox1.SelectionStart = textBox1.SelectionStart + textBox1.Text.Length; } } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง