View Single Post

  #4 (permalink)  
Old 09-26-2006
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

Never tryed it but should be possible. I have suspicion that if you have the control on a sheet, it is exacly the same as having the control on a form, right ?

So dont add it on design time, but on runtime. To add:

Code:
// first create it etc...
// Name of the control here is MP
// Owner is the control where the control is sitting on, eg the sheet

MP.BeginInit();
Owner.Controls.Add(MP);
MP.EndInit();
MP.Visible = true;

// I'm not sure on the sequence for the BeginInit :(
// To move it:
// Owner 2 is the second form / sheet

MP.Visible = false;
Owner.Controls.Remove(MP);
Owner2.Controls.Add(MP);
MP.Visible = true;

// Again I'm not sure what to do with begin/end Init()
This is not test and from the top of my head, so please bear if it crash your system In VBA syntax a little different but this should let you go I think.

Please feedback results, it can benefit other people a lot.
Reply With Quote