Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo Box not behaving the same as other
Message
From
03/07/2006 06:57:22
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Combo Box not behaving the same as other
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01133388
Message ID:
01133388
Views:
47
Hi All.

I have 2 similar combos, each accompanired by a text box. The idea is if you select a descripton value from the drop-down, its assoc. key value (code) is displayed in the text box.

Similarly, if the user just enters the code in the text box, the assoc desc is displayed in the combo.

THe code for each is practically identical, although I've put in the odd tweak and several perm's to get it to work.

Thing is, the recordsource of one (Operator) is numeric, whereas the other's (Family) is char.

The char set-up works fine but, when I enter a numeric code in the operator text box, the combo is displayed in selected highlight, but with no text showing. I f I do it slowly in debug, I can se the combo, remaing unselected, with the correct val in, then it flips to the above.

Record source for both combos are of the form:

Table.Code, Desc

The code for each is below. Any ideas? 'ppreciate it.

Terry
* Code for Text Box .Valid() for Operator - Numeric key val - the problem
* _________________
LOCAL	lcExactSet

lcExactSet		    = SET( "Exact")
Set Exact Off
If not INDEXSEEK( This.Value, .T., "OPERATOR", "CODE")	&& If not find this Operator no in Operators table
    = MESSAGEBOX(	"Sorry, Operator " + ALLTRIM( STR( This.Value)) + " does not exist.", ;
		MB_ICONSTOP, "Operator does not exist")
    With Thisform
      .cmdPreview.enabled	    = .F.
      .cmdPrint.enabled	    = .F.
    EndWith 	  	  
Else
    With Thisform
      With .cboOperators
* For Now>.Requery()  && Cos didn't work WITH it
	.Value 		    = This.value
      EndWith 
      If  .lValidStart;
      and .lValidEnd
          .cmdPreview.enabled  = .T.
	.cmdPrint.enabled     = .T.
      EndIf
  EndWith
Endif
Set Exact &lcExactSet
* Code for Text Box .Valid() for Family - Char data - OK
* _________________
LOCAL	lcExactSet

lcExactSet		     = SET( "Exact")
Set Exact On
If not INDEXSEEK( ALLTRIM( This.Value), .T., "FAMILY", "CODE")	&& If not find this Family no in Family table
    = MESSAGEBOX(	"Sorry, Family " + ALLTRIM( This.Value) + " does not exist.", ;
		MB_ICONSTOP, "Family does not exist")
    With Thisform
      .cmdPreview.enabled	     = .F.
      .cmdPrint.enabled	     = .F.
    EndWith 	  	  
Else
    With Thisform
      With .cboFamilies
 	.Requery()
 	.Value 		     = This.value
      EndWith
      If  .lValidStart;
      and .lValidEnd
	  .cmdPreview.enabled  = .T.
	  .cmdPrint.enabled    = .T.
      EndIf 
    EndWith 
Endif
Set Exact &lcExactSet
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Next
Reply
Map
View

Click here to load this message in the networking platform