Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. copy object attributes

copy object attributes

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Soleda
    wrote on last edited by
    #1

    Hi all, in VB2005, how can I asssign the whole object attributes to another object of the same type. For example, if through the code I've assigned the attributes of a DataGridView object (AllowUserToddrows, ...), is there any way to copy them to another Datagridview object? Thanks in advance, Marc Soleda

    ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

    D 1 Reply Last reply
    0
    • M Marc Soleda

      Hi all, in VB2005, how can I asssign the whole object attributes to another object of the same type. For example, if through the code I've assigned the attributes of a DataGridView object (AllowUserToddrows, ...), is there any way to copy them to another Datagridview object? Thanks in advance, Marc Soleda

      ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      I've never had the need to do this, so a litte research is in order... There's no way to copy a DGV in one line of code, no. The most correct way to do this would be to put the code that setups up your grid properties into a shared method, then just pass the datagrid object you want setup by refrence. Done. No need to copy the object. Other than that, you'd have to create a method that takes a DGV ByRef as a parameter, then code it to create a new DGV object, copy all the properties you want from the supplied DGV to the new one, then return the new object as a return value. [EDIT] You could probably do this with Reflection though. -- modified at 12:32 Wednesday 16th May, 2007

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups