B
BK
I've created a small calculator that will pop up on demand within a
form. The calculator is working fine, but I'm having a focus problem.
The calculator looks almost identical to the Windows calc.exe, I wrote
a replacement so that I could pass values in and out as needed.
The calculator has a text box for the numeric values that are either
typed in or entered by clicking on the visual keypad. Clicking on the
visual keypad works perfectly and entering the numbers manually works
fine if I manually set focus to the text box by clicking on it.
However, if the user clicks on a keypad number then tries to type
additional numbers manually, I have a problem.
All operations and all numeric keypad button clicks point to a common
method. In that method, I entered:
Me.txtInputValue.Focus
The problem is that the text is highlighted (selected), so if the user
combines clicks and types for their data entry (Yeah I know, but there
are users that do this sort of thing) they wipe out text. I changed
this to:
Me.txtInputValue.SelectedText = ""
Me.txtInputValue.Focus
The textbox always has the text selected. Any thoughts on what I'm
doing wrong?
form. The calculator is working fine, but I'm having a focus problem.
The calculator looks almost identical to the Windows calc.exe, I wrote
a replacement so that I could pass values in and out as needed.
The calculator has a text box for the numeric values that are either
typed in or entered by clicking on the visual keypad. Clicking on the
visual keypad works perfectly and entering the numbers manually works
fine if I manually set focus to the text box by clicking on it.
However, if the user clicks on a keypad number then tries to type
additional numbers manually, I have a problem.
All operations and all numeric keypad button clicks point to a common
method. In that method, I entered:
Me.txtInputValue.Focus
The problem is that the text is highlighted (selected), so if the user
combines clicks and types for their data entry (Yeah I know, but there
are users that do this sort of thing) they wipe out text. I changed
this to:
Me.txtInputValue.SelectedText = ""
Me.txtInputValue.Focus
The textbox always has the text selected. Any thoughts on what I'm
doing wrong?