Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I've searched everywhere online and can't find anything on this.

 

Is there was any way to migrate all controls from form to form?

 

I've tried

 

For Each Ctrl as Control in Form2.Controls

Form1.Controls.Add(Ctrl)

Next

 

I get skipped controls and ect...

 

but...

 

If I try to get the name of each control

 

 

For Each Ctrl as Control in Form2.Controls

Debug.Print(Ctrl.Name)

Next

 

It does not skip any and the debugger prints every control's name just fine.

 

Any Ideas? This is really bothering me.

Posted

I have fixed it! :D

 

If anyone has the same problem I experienced, Try this!

 

Me.Controls.Clear()

Dim TempControlRange(1000) As Control

Form2.Controls.CopyTo(TempControlRange, 0)

Me.Controls.AddRange(TempControlRange)

 

Works like a charm!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...