tags:

views:

42

answers:

1

hi

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

+4  A: 

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 += "."
      }
    }
PoweRoy
thank's for the help !!, how to get to the end of the text string ?
Gold
what do you mean? Last character? tb.Text[tb.Text.Length-1]
PoweRoy