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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with ocx

Status
Not open for further replies.

and0b

MIS
Mar 27, 2007
51
US
I'm beginer in VFP programming.
I did register(regsrv32.exe) ocx file I received with my new device. I placed icon(as activeX control) on my new form and now I'm trying to use it(communicate with device). I typed: Thisform.fk524.SetIPAddress='168.192.1.11' and when I run it it is giving error message: "Unknown member fk524". Can somone help me with this problem?

Thank you.
Andrew
 
What is the name of that ActiveX object on your form? (Check in the Properties sheet).
 
fk524 - it was olecontrol1 but I changed name to fk524
 
Andrew,

Which version of VFP are you using?

If you are using VFP 7 or later, have you got Intellisense switched on? If so, as soon as you type THISFORM and the following dot, you should see the names of all the objects contained on the form. Is FK524 one of them? If not, that's where the problem lies.

If it is, after you type THISFORM.FK524 and the following dot, you should see the names of all the properties and methods of the control. Check that SetIpAddress is one of them.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
But it is not and this is why I'm here asking for help.

Andrew
 
I typed: Thisform.fk524.SetIPAddress='168.192.1.11' and when I run it it is giving error message: "Unknown member fk524".

Where, exactly did you type it? Hopefully not in the command window....
 
No, I typed it in the code and this error message is poping up during runtime.
 
Did you place your ActiveX on the form directly or in some container/pageframe?

Before calling your code try

=messagebox(type('thisform.fk524.name')) to see if the object exists.
 
It pop up message window with letter "U" on it.
 
You need to find out where exactly did you put your ActiveX. In the properties sheet see, what is the object above.

Also it could be that the object returned .f. in the Init and didn't produce an error message (say, you have your own error handler that "ate" the error).
 
Form1 is the object above fk524. This is very beginning of this program, I just have empty form with only icon of this ole object. This statment I'm trying during form load, and trhis is 4th line of code. I'm going to build this code when I will connected.
 
You should not do it in Form's Load. Move your code into form's Init, it would work. In the load of the form objects are not yet instantiated.
 
This same, I move code first to init, next I placed button on this form and move this code to this button(button-click), still this same error. Only diference is so now message box shows "C" letter.
 
If the messagebox shows C now, then we're making some progress <g>, the object now exists. The problem is, does it have this property, which you're trying to set? SetIPAddress sounds like a method, perhaps it should be

thisform.myObject.SetIPAddress(IPAddress) instead.

If you want to check if the property exists, use PEMSTATUS function.
 
This ocx is working with VB6.0. I'm trying to use it with Foxpro because first: I prefer this language, second: I will work a lot with databases later in this program.
 
thisform.myObject.SetIPAddress(IPAddress) does not work.
 
Post some of the VB code.

Also you may check type('thisform.fk524.SetIPAddress')
 
I dont think its getting instantiated.

The activeX object is part of your form i.e. You put it on the form in design mode, right? Or are you calling it in code with a CreateObject()?

Like Ilyad says a "C" is good, unless you have declared "fk524" as a public variable. its there, but is not an object.

Sometimes; if there is another control that was placed on the form like a textbox, before "fk524" and the init of the textbox is calling "Fk524", you will get the error, as fk524 has not yet been initialized.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top