Insert '.' when press '#' in textbox using C#

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3227
    John Coder
    Member

    I have a textbox control, I want to insert ‘.’ in stead of ‘#’ means when i press ‘#’ from keyboard then textbox insert ‘.’ character.

    please help

    thanks

    #3228

    try this code:

       private void textBox1_KeyPress(object sender, 
                                           KeyPressEventArgs e)
            {
                if (e.KeyChar == (char)35)
                {
                    e.KeyChar = (char)46;
                }
            }
    

    thanks

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.