which language do u speak ?
Printable View
which language do u speak ?
i think if say you my language you will never talk me again
but i say you greek
what language u speak ?
GREEK
i am from greece
θέλετε να αντικαταστήσετε το κουμπί με το πλήκτρο enter ?
did u understand ?, n why would i not speak to u wats bad in ur languge ?
yes
and you are from greece or somewhere else
m form somewhere else , ok write your question in greek in detail
γράψτε την ερώτησή σας στην ελληνική λεπτομερώς
Post 49 is as equally clear to me as all the other posts.
That's a worry.
καλά εσείς το ζητήσατε όχι εγώ, οπότε ξεκινάω
θέλω ένα κουμπί του πληκτρολογίου πχ το + όταν πατιέται να κάνει ακριβώς το ίδιο πράγμα με το κουμπί οπτικό κουμπί της visual basic
αυτό και μόνο
sory understood a bit , well u want to press + button on keyboard and do what ? what result u want by pressing + key m asking that
τι αποτέλεσμα που θέλετε πατώντας + πλήκτρο
Code:Private Sub cmdADD_Click()
num1 = SCREEN1.Text
SCREEN1.Text = ""
op = "+"
End Sub
that
u want to make a add button rit ?
i can do that with enter key
do it
Dim KeyNumber As Integer
For KeyNumber = 1 To 132
If GetAsyncKeyState(13) < 0 Then
text1.text=text2.text+ val (text3.text)
End If
Next
make 3 box , write value in 2 and press button the answer will be in textbox 1
for this where i have to write itCode:Dim op As String
Dim num1 As Double
Dim num2 As Double
Private Sub cmd0_Click()
SCREEN1.Text = SCREEN1.Text & "0"
End Sub
Private Sub cmd1_Click()
SCREEN1.Text = SCREEN1.Text & "1"
End Sub
Private Sub cmd2_Click()
SCREEN1.Text = SCREEN1.Text & "2"
End Sub
Private Sub cmd3_Click()
SCREEN1.Text = SCREEN1.Text & "3"
End Sub
Private Sub cmd4_Click()
SCREEN1.Text = SCREEN1.Text & "4"
End Sub
Private Sub cmd5_Click()
SCREEN1.Text = SCREEN1.Text & "5"
End Sub
Private Sub cmd6_Click()
SCREEN1.Text = SCREEN1.Text & "6"
End Sub
Private Sub cmd7_Click()
SCREEN1.Text = SCREEN1.Text & "7"
End Sub
Private Sub cmd8_Click()
SCREEN1.Text = SCREEN1.Text & "8"
End Sub
Private Sub cmd9_Click()
SCREEN1.Text = SCREEN1.Text & "9"
End Sub
Private Sub cmdADD_Click()
num1 = SCREEN1.Text
SCREEN1.Text = ""
op = "+"
End Sub
Private Sub cmdCLEAR_Click()
SCREEN1.Text = ""
End Sub
Private Sub cmddie_Click(Index As Integer)
num1 = SCREEN1.Text
SCREEN1.Text = ""
op = "/"
End Sub
Private Sub cmddin_Click()
num1 = SCREEN1.Text
op = "^"
End Sub
Private Sub cmdison_Click()
num2 = SCREEN1.Text
SCREEN1.Text = ""
If op = "+" Then
SCREEN1.Text = num1 + num2
ElseIf op = "-" Then
SCREEN1.Text = num1 - num2
ElseIf op = "x" Then
SCREEN1.Text = num1 * num2
ElseIf op = "/" Then
SCREEN1.Text = num1 / num2
ElseIf op = "^" Then
SCREEN1.Text = num1 ^ 2
End If
End Sub
Private Sub cmdkoma_Click()
If SCREEN1.Text = "" Then
SCREEN1.Text = SCREEN1.Text & "0,"
ElseIf Not SCREEN1.Text = "" Then
SCREEN1.Text = SCREEN1.Text & ","
End If
End Sub
Private Sub cmdmion_Click()
If SCREEN1.Text = "" Then
SCREEN1.Text = SCREEN1.Text & "-"
ElseIf Not SCREEN1.Text = "" Then
num1 = SCREEN1.Text
SCREEN1.Text = ""
op = "-"
End If
End Sub
Private Sub cmdpolap_Click(Index As Integer)
num1 = SCREEN1.Text
SCREEN1.Text = ""
op = "x"
End Sub
it cant be done this way for this code
so how can it be done ?
you will have to set foucs on something and set the code at keypress event
and the keypress event how does it works?
You guys don't seem to be talking about the same thing. Looks like paok is trying to make a calculator, yes?
I want a button on the keyboard eg, the + when pressed to do the same thing with the optical button visual basic
that's all
Dim KeyNumber As Integer
For KeyNumber = 1 To 132
If GetAsyncKeyState(13) < 0 Then
your code for optical button
End If
Next
put this code in timer and set interval to 1 , press enter
Why a timer? Why the GetAsync Key state?
If you want to capture a keypress in VB set the form keypreview=true and use the form keydown or keypress event.
And never set the timer interval to 1
If the timer actually could work that fast then it may try to execute your code 100 times when you press the button
i dont know to use the case select option that why i use this code
and set the form key preview = trueCode:Option Explicit
Dim result As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim KeyNumber As Integer
For KeyNumber = 1 To 132
If GetAsyncKeyState(vbKeyAdd) < 0 Then
cmdADD_Click
End If
Next
End Sub
and press + key at the numpad
this worked ?
the 0 at the come what does?
not getting u what u saying ?
here the 0 who is the role of itCode:If GetAsyncKeyState(vbKeyAdd) < 0 Then
it means if pressed
Don't use the loop in the key press event. Use select case instead.
You also do not need to use the keyasync stuff
Note: rather than use the ASC() you can look up the ascii codes for the symbols and use the decimal code instead as I have shown for the enter key.Code:Select case KeyAscii
Case asc("+")
'code for whatever you want to do if the key was the + key
Case asc("-" )
'code for when the - key is pressed
Case 13
'when the enter key is pressed
End Select
i have to insert a timer?
There is no need for a timer if you want to capture keys pressed within your application you use the Keypress or Keydown event this is what they are there for.
the next what does?Code:End If
Next
End Sub
it gets me an error hear
put this line at top of code
Code:Option Explicit
Dim result As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer