Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Number TextBox

Number TextBox

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kamrul Hasan
    wrote on last edited by
    #1

    Can Some help me to make a textbox in which user can type only numerical or Uppercase charecters ?

    J M A 3 Replies Last reply
    0
    • K Kamrul Hasan

      Can Some help me to make a textbox in which user can type only numerical or Uppercase charecters ?

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Search this site for masked textbox, you should get some hits.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango

      1 Reply Last reply
      0
      • K Kamrul Hasan

        Can Some help me to make a textbox in which user can type only numerical or Uppercase charecters ?

        M Offline
        M Offline
        MoustafaS
        wrote on last edited by
        #3

        Itis bretty easy just override the OnTextChanged event and check the new char if it is a number or uppercase,you can know about numbers by putting them in an array,or just trying double.TryParse() function,in a try-catch block;

        1 Reply Last reply
        0
        • K Kamrul Hasan

          Can Some help me to make a textbox in which user can type only numerical or Uppercase charecters ?

          A Offline
          A Offline
          Alomgir Miah
          wrote on last edited by
          #4

          Capture the KeyPress Event of TextBox The following is for numeric. Add condition for Upper Case. private void TextBoxInceptionANAKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { try { //Handle only if the value being entered is NUMERIC if (e.KeyChar >= (char) 48 && e.KeyChar <= (char) 57 ) { e.Handled = false; } else { //Sound beep MutualFundHelper.SoundBeep(); e.Handled = true; } } catch (Exception exception) { MessageBox.Show(exception.Message); } }

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups