Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
.AddObject() -> Object Name is invalid
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
.AddObject() -> Object Name is invalid
Divers
Thread ID:
00851659
Message ID:
00851659
Vues:
45
Hi

I have a form which has OLE object in it. The form definition is contained in a non visual class as is the definition of the OLE object.
PUBLIC oMain
oMain = CREATEOBJECT('main')
oMain.Show()
READ EVENTS

DEFINE CLASS main AS form
	Name = "Main"
	Desktop = .T.
	ShowWindow = 2
	DoCreate = .T.

	ADD OBJECT oTcpIp AS tcpip_server WITH ;
		Visible = .F.
:
:
ENDDEFINE

DEFINE CLASS TCPIP_Server AS olecontrol
	Name = "TCPIP_Server"
	OleClass = 'Server.MyServer'
:
:
ENDDEFINE
This works fine but priodically the OLE hangs and I need to be able to destroy the object and recreate it. (it's a little temperamental).

When I issue an
oMain.RemoveObject('oTcpIp')
oMain.AddObject('oTcpIp', 'tcpip_server')
I get an Object Name is invalid error. The same happens when I use an empty container as my class. When I look in the debugger after the 'RemoveObject' I see that the object has not been destroyed (i.e. not removed).

Using a public variable and releasing that is not really an option as the OLE needs to be bound to the form.

Can someone explain why objects (even empty container objects) are not completely removed by the RemoveObject or what I am doing wrong and how I can fix it?

Somewhat confused.
Geoff Scott
May all your weeds be wildflowers
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform