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

Home Forums General Programming C# Insert '.' when press '#' in textbox using C#

This topic contains 0 replies, has 2 voices, and was last updated by  Hirendra Sisodiya 6 years, 7 months ago.

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.