KB-36987: Preventing an operator from typing a dot in a SetPoint.

Question:

On an application, when an operator types a number using a dot as the decimal symbol, this dot is suppressed and the SetPoint understands the value as an integer, because Windows is configured to use the colon as the decimal symbol.

To avoid this problem, how can I prevent the operator from typing a dot on a SetPoint?

Solution:

To do so, you can use VBScript’s SendKeys function in the SetPoint’s KeyDown event to automatically erase the dot. You can also set it up to display a message telling the users that they must use a colon instead of a dot. For example:


Sub Text1_KeyDown(KeyCode, Shift)
     'KeyCode = 194 (numeric keyboard's dot)
     'KeyCode = 190 (alphanumeric keyboard's dot)
     if KeyCode = 190 or KeyCode = 194 then
          set WshShell = CreateObject("WScript.Shell")
          MsgBox "Use a colon instead of a dot as the decimal symbol."
          WshShell.SendKeys "{BACKSPACE}"
    end if
End Sub
Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *