Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: chaim dudi
  Where is chaim dudi?
 Jerusalem
 South Carolina - Israel
 chaim dudi
 Tags
Subject: RE: Verify textbox typing inside
Thread ID: 228347 Message ID: 228351 # Views: 1 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Monday, May 18, 2009 12:27:56 PM         
   


> Hi
>
> How can I force the user to enter valid data in textbox without to send the code to form method or to send the focus back and forth to other control?
> (I cannot add code 'this.value' in lost focus, since the current control is not 'This').
>
> Thank

The current control is always "THIS" if you use it in its own methods or events.
But I'll recommend you to validate all data at once in some form method, not control by control, just becuase if you change something after a while it will be much more easier to do the change.
You could use thie full reference to control in your validation method:
**** Control LostFocus:
IF NOT thisform.ValidateData()
   NODEFAULT
   this.SetFocus()
   RETURN
ENDIF


**** Validate data 
LOCAL msg
msg = ""
IF thisform.Control.Value # something
   msg = The value of Control is not valid"+CHR(13)
ENDIF

IF thisform.OtherControl.Value # othervalue
   msg = The value of OtherControl is not valid"+CHR(13)
ENDIF

IF NOT EMPTY(msg)
   MessageBox(msg)
   RETURN .f.
ENDIF
RETURN .t.



-----------------
Borislav Borissov

Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.

ENTIRE THREAD

Verify textbox typing inside Posted by chaim dudi @ 5/18/2009 12:07:14 PM
RE: Verify textbox typing inside Posted by Cetin Basoz @ 5/18/2009 12:22:39 PM
RE: Verify textbox typing inside Posted by Borislav Borissov @ 5/18/2009 12:27:56 PM
RE: Verify textbox typing inside Posted by Ammar Hadi @ 5/18/2009 1:23:17 PM