Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How I can check the valide option of combo box. I wrtie a message at valid event "Blank entry not allowed" but it does not check this event and control transfer to next box.
Please guide.

Ahsan Rana

 
HI
In the valid event PUT THE CODE...

IF EMPTY(This.Value)
=MESSAGEBOX("RETRY AGAIN",16,"INVALID ENTRY")
RETURN .f.
ELSE
RETURN .T.
ENDIF

THIS SHALL TAKE CARE OF YOUR NEED.
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
returning .f. prevents the user form exiting the box with an entry. concider what happens when the user changes there mind and need to click the exit/cancel button. they would not be able to because of the return .f.

to work around this set the property Cancel of the exit/cancel button to .t.

in you valid event just before
if lastkey() = 27
return .t.
endif
this will let the user change their mind and exit the form. Attitude is Everything
 
Hi

Valid option is only working when the style is DropDown Combo and if I set it as DropDown List then it does not check the condition and user entering data thru Key Board passes over the combo box with our selection from combo box.

Please recheck and advise

Ahsan Rana
 
it sounds like to me the user is never entering the DropDown List?? If not then you need to force this to happen with code.

the valid function will always fire when the focus leaves the control if there is any code in the event.

the only time this does not happen is when there are toolbar controls that recieve the focus from a mouse click.
then you need to put in the toolbar conrol activate event the code to force the lost control to fire. Attitude is Everything
 
Hi

Use is only selecting record from DropDown List. Could you please let me know the codes which prevents to leave with out selecting any record. I try with the following codes:-
If Empty(This.Value)
MessageBox("XXXXXX")
endi

Ahsan Rana
 
one way

add a property to the form
coboval

in the when or gtofocus of the combo box
thisform.cobval = .f.

in the lostfocus of the combo box
if !thisform.cobval
this.valid()
endif

add to the valid event
thisform.cobval = .t.
Attitude is Everything
 
Yup. Good job mbru. The KB article says it is a bug in versions 3.0 through 6.0. If you aren't using 7.0, you may have to upgrade to get the proper functionality.
Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top