Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple Q about a 'datasource' for a textbox
Message
From
15/02/2002 01:34:30
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00620359
Message ID:
00620509
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
Randy,

No problem. I withheld a more OOP solution from you *grin*. Here it is:

Using this method, you will do a thisform.release(), instead of a hide(). You add a property to the modal form, in this example it is called dateRange. The controlSources of the textboxes become thisform.dateRange.startDate and thisform.DateRange.endDate.
local loDateRange

loDateRange = createobject("dateRangeClass")
loDateRange.startDate = date() - 365
loDateRange.endDate = date()
do form test with loDateRange to loDateRange
* loDateRange.startDate and loDateRange.endDate contain values returned from form
* do your processing here

define class dateRangeClass as custom
	startDate = {}
	endDate = {}
enddefine
* init() method of form
lparameters loDateRange

if vartype(loDateRange) == "O"  && do some error checking
	this.dateRange = loDateRange
else
	error "Invalid parameter passed to form"
endif
* unload() method of form
return this.dateRange
In dateRangeClass, you can add code the makes sure that the dates are valid. The start date should be on or before the end date. For example, you could put test in a method called valid() (within the dateRangeClass). Call this method before releasing the form, to make sure the user has entered a valid date range.

Now you have to decide which way you want to do it :)

>Thanks, Steve for the complete and compact solution.
>The OOP world is still poking me now and then
>reminding me that there's much to learn. Makes ya pine for
>the o'le @ SAY GET --- NOT!
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform