AndrewMozley
Programmer
A dropdown listbox (Class Combo) is used to enter a single character (<space>,‘C’, ‘S’, ‘B’, ‘L’) credit status for a customer. where <space> indicates open credit, ‘C’ Cash only &c. The control has as its controlsource a field in the table being maintained, and its other properties include :
Format !
RowSource type 5 - Array
Style 0 – Dropdown combo
Its RowSource is set to an array aCredOptions
When the user clicks on the Down arrow and then clicks on one of the 5 rows of the dropdown (say, “S”), that works fine. The form shows the value “S” in the listbox and the corresponding description is also displayed.
If the user enters one of the five values into the control, that also works.
What is the best way of ensuring that the character entered into the listbox (if the user is working that way, rather than using the down-arrow) is valid? Is it a matter of putting code onto the KeyPress() event? At present I have this code :
Would welcome guidance - maybe I should be using a different control class . . . .
Thanks for your help.
Format !
RowSource type 5 - Array
Style 0 – Dropdown combo
Its RowSource is set to an array aCredOptions
When the user clicks on the Down arrow and then clicks on one of the 5 rows of the dropdown (say, “S”), that works fine. The form shows the value “S” in the listbox and the corresponding description is also displayed.
If the user enters one of the five values into the control, that also works.
What is the best way of ensuring that the character entered into the listbox (if the user is working that way, rather than using the down-arrow) is valid? Is it a matter of putting code onto the KeyPress() event? At present I have this code :
Code:
* cboCredit.Keypress()
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL lChar
lCHAR = UPPER(CHR(nKeyCode))
IF !(lChar $ " BCLS") .AND. nKeycode > 48
NODEFAULT
RETURN
ENDIF
RETURN DODEFAULT(nKeyCode, nShiftAltCtrl)
Would welcome guidance - maybe I should be using a different control class . . . .
Thanks for your help.