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
  1. Home
  2. General Programming
  3. Visual Basic
  4. calculator accept "/" and "+" when I press from keyboard numlock

calculator accept "/" and "+" when I press from keyboard numlock

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestionlearning
3 Posts 3 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.
  • V Offline
    V Offline
    vblearner09
    wrote on last edited by
    #1

    I am new to VB 2008, and I am learning this new language VB. The project I started to write a small program Calculator that will do just like a real calculator on (Windows XP). I ran in some problems when I am trying to write routine to accept "/" divide, "+" plus, and "-" minus from right side of the keyboard. with press NUMLOCK ON. When I press NUMLOCK ON, the program should accept the "/", "*", "-", "+" and perform arithmetic. My program calculator now can accept "/", "*", "-" when I used the mouse to press buttons on the calculator's interface. Can someone tell me what the code will be? I am stuck...and I need help.. how to write the routine that will accept the operand to perform the basic arithmetic thanks for everyone can help!! Andy

    N P 2 Replies Last reply
    0
    • V vblearner09

      I am new to VB 2008, and I am learning this new language VB. The project I started to write a small program Calculator that will do just like a real calculator on (Windows XP). I ran in some problems when I am trying to write routine to accept "/" divide, "+" plus, and "-" minus from right side of the keyboard. with press NUMLOCK ON. When I press NUMLOCK ON, the program should accept the "/", "*", "-", "+" and perform arithmetic. My program calculator now can accept "/", "*", "-" when I used the mouse to press buttons on the calculator's interface. Can someone tell me what the code will be? I am stuck...and I need help.. how to write the routine that will accept the operand to perform the basic arithmetic thanks for everyone can help!! Andy

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Handle the form's KeyPress[^] event. KeyEventArgs.KeyCode gives you the current key which is pressed.

      Navaneeth How to use google | Ask smart questions

      1 Reply Last reply
      0
      • V vblearner09

        I am new to VB 2008, and I am learning this new language VB. The project I started to write a small program Calculator that will do just like a real calculator on (Windows XP). I ran in some problems when I am trying to write routine to accept "/" divide, "+" plus, and "-" minus from right side of the keyboard. with press NUMLOCK ON. When I press NUMLOCK ON, the program should accept the "/", "*", "-", "+" and perform arithmetic. My program calculator now can accept "/", "*", "-" when I used the mouse to press buttons on the calculator's interface. Can someone tell me what the code will be? I am stuck...and I need help.. how to write the routine that will accept the operand to perform the basic arithmetic thanks for everyone can help!! Andy

        P Offline
        P Offline
        Paramu1973
        wrote on last edited by
        #3

        From the KeyDown Event, you can check if e.KeyCode =Keys.NumLock or e.keycode=Keys.NumPad0 or...whatever else as per the need.

        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