Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to subclassing the form with parameter ability ?

Status
Not open for further replies.

stvhui

Programmer
Jul 17, 2002
13
ID
Hello to you,
I'm uisng vfp7

I tried to subclassing the form as below :
form's init :
parameter cMode
thisform.mode = cMode

Note : I add a new property to form named "mode"

Then I tested issuing :
do form abc with "xyz"

but it does't work, why ?

Please advice
Steven
 
What do you call subclassing? Normally, subclassing applies to classes not forms. In other words when you subclass a form you would class the form's subclass with:
Code:
oForm=CREATEOBJECT("mySubClassedFomr")
oForm.Show(1)

 
what is your error message? if it is data type mismatch, then in the property box of the form set the new property to the data type you are expecting to pass to it.

mode = ''

NOTE: unless you save the form to a visual class or write it with code with DEFINE CLASS, you are not subclassing. Attitude is Everything
 
HI

myForm.InitEvent
==================
parameter cMode
thisform.mode = cMode
Wait window ThisForm.cMode

Then.. DO FORM myForm WITH "XYZ"

This will provide the value of ThisForm.cMode in a wait window. You can check out if the value is passed on. I suspect, you are initialising the property somewhere again.

I suggest, you try to use valriable names which are distinct from foxpro commands. Occasionaly you bump on reerved words in a subsequent revision of VFP even though it may not be a reserved word in the development version. So th rule will be to stay away fom common command words. Mode can easily be a command word. ATleast make it cWord at the forms property. and pcWord in the init event.

Have a nice day :)


ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top