简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM