Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 To: Sandeep Misra
  Where is Sandeep Misra?
 Connecticut - United States
 Sandeep Misra
Subject: RE: accessing forms after show
Thread ID: 112328 Message ID: 112330 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: Forms
Date: Tuesday, November 07, 2006 12:38:50 PM         

Hi Sandeep

I have a situation where i am creating a form to display certain text boxes and labels. The user has the privilege to enter data into this form textboxes.
> i need to do a validation on some data that has been entered into the text boxes of the form by the user.
> i am creating a form object of an existing form class which has an OK click event method. This method releases the form object once executed.I want the field validations to happen before releasing the form on the OK click event.

One solution is to override the method code in the class, a better one is to amend the method code in the class as follows:

IF ThisForm.ValidateData()
  *** Code to release
  *** Message - cannot save because data is not valid

Now add a method called "ValidateData" to your form class. If it is empty, it will always return .T. so existing forms will not be affected by this change. In your new form however, you can put code in the ValidateData method and have it return .T. if all is ok (the form will close) or .F. and stop the form closing.

Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA


accessing forms after show Posted by sandeep misra @ 11/7/2006 12:04:34 PM
RE: accessing forms after show Posted by Andy Kramek @ 11/7/2006 12:38:50 PM
RE: accessing forms after show Posted by Ken Murphy @ 11/7/2006 1:17:40 PM