开发者

when i press (*) how to get (.) in TextBox (in C# WinCE)

开发者 https://www.devze.com 2023-01-01 00:57 出处:网络
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

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 += "."
      }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消