VS 2010 [RESOLVED] Duplicate Control-VBForums
Results 1 to 4 of 4

Thread: [RESOLVED] Duplicate Control

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2011
    Posts
    198

    Resolved [RESOLVED] Duplicate Control

    Hi all

    Wondering if there is a way I can duplicate controls and have them work properly?

    basically, i have a datagridview with code in it plus buttons that do various things to it etc etc

    ideally, i'd like to be able to have two of these datagridviews on show

    So, user presses button, second datagridview shows.

    Note that I don't want them to both display the same data - they should both be independetly editable..

    Cheers!

  2. #2
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    278

    Re: Duplicate Control

    Why not just create the second datagridview and on form load set:

    vbnet Code:
    1. DataGridView2.Visible = False

    When the user presses the button:

    vbnet Code:
    1. DataGridView2.Visible = True

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2011
    Posts
    198

    Re: Duplicate Control

    Thanks for the reply! . If I were to simply copy and paste the dgv would that create any issues with the code within it? For example I have some code which works depending on the state of the checkbox column etc. would it simply be a case of changing the code to DataGridView 2 instea of DatagridView 1?

    Thanks for your help!

  4. #4
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    278

    Re: Duplicate Control

    If you copy the control it will rename itself to DataGridView2 and so all the code for DataGridView1 won't apply to it.

    Yes you can just copy the code too, changing each bit to DataGridView2.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.