- Messages
- 879
- Reaction score
- 3
- Points
- 28
Good eve!
back ako sa tanong ko sa visual basic.
I'm making a calculator, pano magandang gawin para once lang pwede pindutin yung decimal (.) i mean pag present na yung tuldok kahit pindutin mo siya wala nang output.
Use INSTR() sir,
If Instr(1, txtInput.Text, ".") > 0 then
'Decimal point was detected here, so just exit
Exit Sub
Else 'Result of INSTR was 0
'If not detected, put the decimal point.
End If
mga sir .. may command po ba sa vb 6 na dapat number lang ang pwedeng ilagay sa text box? at kung character lang dapat ang lalagay sa textbox? otherwise error?
Dun sa Keypress Event, pwede mo i-capture at ignore ang mga key strokes...
Private Sub txtQuantity_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 13
'Allow Enter Key
Case 8
'Allow Backspace
Case 48 To 57, vbKey0 To vbKey9
'Allow only numerics
Case Else
KeyAscii = 0
End Select
End Sub
Last edited: