Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List control
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00461538
Message ID:
00461574
Views:
14
Hi Sherry.

>> In one of my form, I am using a list box control. Users can select any elements from the list. If the item does not exist( the listitemid will return -1) I would open another form so the users can enter a new item. I put that portion of the codes in the keypress event but it did not work. Where should I put the codes?? <<

You have me a little confused here. If you are using a scrolling List (i.e., a List Box), then the user can not select something that is not in the list. Are you really talking about a combo box here of style = 0 (drop down combo) where the user can type text into the text box portion of the control? If this is the case, code like this in the Combo's Valid method should do it for you:
*** Check to see if the user entered an item not in the list
IF !EMPTY( This.DisplayValue ) AND This.ListIndex = 0
  *** Now call the maintenance form
  DO FORM < MyForm > WITH loParameters TO lnRetVal
  lnValue = IIF(lnRetVal = 0, This.Value, lnRetVal )
  This.Requery()
  This.Value = lnValue
ENDIF
Marcia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform