none
Panel RRS feed

  • Question

  • Hi Guys,

    I am new at visual basic 2017. I can't find any info on how to copy/clone/multiply a panel with a control on it and how to move the copied/cloned panels and their controls inside.

    Thanks!

    Wednesday, November 22, 2017 2:39 PM

All replies

  • Yea when you do Help, Feed Back you see that there are big problems with copy and past

    If it is solved seems to be under consideration.


    Success
    Cor



    • Edited by Cor Ligthert Wednesday, November 22, 2017 3:46 PM
    Wednesday, November 22, 2017 3:25 PM
  • Sure you can clone controls but not events and if you take into consideration controls with a ControlCollection, controls that can be loaded e.g. ComboBox, ListBox, DataGridView etc in different ways than the answer is no this is simply not possible without writing a lot of code, getting into Reflection. Even implementing a user control has issues similar to the above.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 22, 2017 5:14 PM
    Moderator
  • Are you referring to design-time or run-time in code? If the latter then the below thread made help:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/815c644e-fa9d-462d-8331-ce1a41eab21a/how-to-clone-a-control-in-win-form-at-run-time?forum=vbgeneral


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, November 22, 2017 5:21 PM
  • Karen and Paul,

    In past you could do Cut the panel. Past it on a new form and then on the original form, ctrl Z. 

    Everything was copied, even the handle clauses to both forms, with copy the handle clauses disapeared. 

    That could even with C# forms to VB but then of course not the handle clauses. 

    Currently I tried to copy a very simple panel with one button upon it to a form in both ways. Only the button was copied, and the method (not the handle clause). 

    I did not suggest another bug when I discovered it was already loaded with bugs around copy and past.  

    Of course you can do that in code, but you can also put a horse behind a cart and start yourself pulling. 

    :-)


    Success
    Cor

    Wednesday, November 22, 2017 6:38 PM
  • Hi Boddah7,

    If you want to copy or clone the panel and contains all control in panel, you can take a look the following example:

    https://stackoverflow.com/questions/44342883/how-to-clone-the-panel-control-to-the-same-form-dynamically-in-vb-net

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 28, 2017 6:33 AM
    Moderator