Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Bob Lawson
  Where is Bob Lawson?
 Oakville, Ontario
 Canada
 Bob Lawson
 To: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
Subject: RE: RemoveObject / AddObject
Thread ID: 115797 Message ID: 115805 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: Forms
Date: Tuesday, December 12, 2006 1:14:56 AM         
   



> > I am trying to replace a button at runtime. I am using:
> >
> > theform.navigate1.RemoveObject( [btnDelete] )
> >
> > theform.navigate1.AddObject( [btnDelete], [CastBtnDelete] )
> >
> > But I get an 'Object Name is Invalid' error when I try and do the AddObject.
> >
> > If I change the AddObject call to:
> > theform.navigate1.AddObject( [btn2Delete], [CastBtnDelete] )
> >
> > then it works fine. So it is finding my object. There are other references to
> > the object so I was hoping to keep the object name the same.
> >
> > Is this possible?
> >
> > Bob
>
> Bob,
>
> it looks like your "btnDelete" is not actually removed from the containing form, hence the error: VFP thinks that you are trying to duplicate an object, or add an object of the same class and with the same name as the one already existing.
>
> HTH.
>
> Regards,
>
> Ilya
Well the Delete button disappears from the form.

Also any lines after the Addobject would complain that btnDelete was not a valid object.
So it would appear that it did was removed.

Bob

ENTIRE THREAD

RemoveObject / AddObject Posted by Bob Lawson @ 12/11/2006 11:19:19 PM
RE: RemoveObject / AddObject Posted by Ilya Rabyy @ 12/11/2006 11:34:51 PM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 1:14:56 AM
RE: RemoveObject / AddObject Posted by Ilya Rabyy @ 12/12/2006 1:26:00 AM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 1:41:42 AM
RE: RemoveObject / AddObject Posted by Ilya Rabyy @ 12/12/2006 1:45:41 AM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 1:54:57 AM
RE: RemoveObject / AddObject Posted by Ken Murphy @ 12/12/2006 1:45:38 AM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 1:54:23 AM
RE: RemoveObject / AddObject Posted by Ken Murphy @ 12/12/2006 1:00:50 PM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 1:20:52 PM
RE: RemoveObject / AddObject Posted by Ken Murphy @ 12/12/2006 1:31:05 PM
RE: RemoveObject / AddObject Posted by Ilya Rabyy @ 12/13/2006 5:03:23 PM
RE: RemoveObject / AddObject Posted by Bernard Bout @ 12/12/2006 4:07:03 AM
RE: RemoveObject / AddObject Posted by Andy Kramek @ 12/12/2006 11:41:28 AM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 12:53:23 PM
RE: RemoveObject / AddObject Posted by Bob Lawson @ 12/12/2006 12:56:57 PM
RE: RemoveObject / AddObject Posted by Andy Kramek @ 12/12/2006 5:09:11 PM
RE: RemoveObject / AddObject Posted by Barbara Peisch @ 12/12/2006 7:41:59 PM
RE: RemoveObject / AddObject Posted by Ken Murphy @ 12/12/2006 7:45:50 PM
RE: RemoveObject / AddObject Posted by Borislav Borissov @ 12/12/2006 7:52:58 PM
RE: RemoveObject / AddObject Posted by Barbara Peisch @ 12/12/2006 8:08:54 PM