Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record searching on textbox lostfocus event
Message
De
02/10/2003 16:27:41
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00834029
Message ID:
00834483
Vues:
22
What is the actual index on? Does it have to be trimmed? Upper? Etc... Is EXACT on or off? What about near?

What about:
SET EXACT ON
SET NEAR OFF
IF THIS.llunique
   lcvalue = ALLTRIM(UPPER(THIS.value))
   lcindex = ALLTRIM(UPPER(THIS.lcindex))
   lctable = ALLTRIM(UPPER(THIS.lctable))
   IF !EMPTY(lcvalue) AND !EMPTY(lcindex) AND !EMPTY(lctable)
      IF SEEK(lcvalue, lctable, lcindex)
         MESSAGEBOX('This value already exists')
      ELSE
         MESSAGEBOX('Ok to add this value.')
      ENDIF
      * Try a locate here just for fun to see if IT works:
      SELECT (lctable)
      GO TOP
      LOCATE FOR ...
      IF FOUND(lctable)
         MESSAGEBOX('Locate found it')
      ELSE
         MESSAGEBOX('Locate did NOT find this value.')
      ENDIF
   ELSE
      MESSAGEBOX('ERROR! Cannot attempt to locate this value.')
   ENDIF
ENDIF
>Hi All,
>i've a textbox class and i've added 3 property to it. called lctable,lcindex,llunique.
>i wantto do when the user lost the focus of the textbox , lost focus event of textbox will search entered value on the table and will alert that 'this record allready saved on this table' etc.. i've code below but vfp gives "this record allready exist on this table" as my messagebox syntax.
>
>here is my code,
>
>* textbox lostfocus event code
>If This.llunique = .T.
>lcvalue=this.value
>	SEEK (this.value) ORDER (this.lcindex) IN (this.lctable)
>If Found()
>		Messagebox("&lcvalue allready exist on the table",16,"Opps...")
>		This.SetFocus
>	Endif
>Endif
>
>
>So, it doesnt noticed that if user enter some values or not
>eg (there is 2 record on the table which is idno 123 and 1234 ) vfp behaviour allways found()=.t. but when i enter eg 'rtf123' i am getting same alert why ?
>
>how is your suggestions about this matter? i wantto use this control in my standart base txtbox class and it should be parametric for tablename,indexname and will search entered value if found() .f. no problem can append or etc, if .t. must alert the user 'this value allready exist'
>
>how can i do this ?
>
>PS : sory for the bad english but i am very sleeples and tired :)
>
>TIA
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform