when i press (*) how to get (.) in TextBox (in C# WinCE)
when i press (*) how to get (.) in TextBox (in C# WinCE)
i have TextBox and when i press the (*) letter i want to get the (.) letter
thank's i开发者_开发技巧n advance
Use the keypress and if the key is a '*' then replace it with '.'?
see here
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyCode == Keys.Multiply) e.KeyCode = Keys.OemPeriod;
}
if you can't set the e.KeyCode then you can do:
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyCode == Keys.Multiply)
{
e.Handled = true;
tb.Text += "."
}
}
精彩评论