Eg: Calculator

How to assign numbers in key board to corresponding buttons in the calculator?

hi
U Can write the code on keypress event of button.First u have to get the Ascii value of keys of keyboard.then write the code

if asc(e.keypress)=13 then
//ur code
endif

here 13 is value for Enter.

Hope it wil help u
All the best

normally i use keydown


Private Sub btnPost_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btnPost.KeyDown

Select case e.keyCode
case keys.u
lblKey.text = "U"
End Sub

Hope this is useful for you

How to get ascii values for all keys in keyboard??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.