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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to tranfer an object from Form1 to Form2

How to tranfer an object from Form1 to Form2

Scheduled Pinned Locked Moved Visual Basic
helptutorial
3 Posts 3 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.
  • B Offline
    B Offline
    Bso_Cool
    wrote on last edited by
    #1

    I am trying to move a label from form1 to form2 and I don't want to have to create another label on form2 and transfer all the information it carries to the other form and then back again. So what I want to do is just move the label from form1 to form2 and then later back again. If anyone can help it would be greatly appreciated. Thank You!

    D C 2 Replies Last reply
    0
    • B Bso_Cool

      I am trying to move a label from form1 to form2 and I don't want to have to create another label on form2 and transfer all the information it carries to the other form and then back again. So what I want to do is just move the label from form1 to form2 and then later back again. If anyone can help it would be greatly appreciated. Thank You!

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

      That's not a real good idea. You'd be much better off and have far more maintainable code if you just created the label on the second form and changed the text property when you needed to. What you're proposing is overly complex for little benefit.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      1 Reply Last reply
      0
      • B Bso_Cool

        I am trying to move a label from form1 to form2 and I don't want to have to create another label on form2 and transfer all the information it carries to the other form and then back again. So what I want to do is just move the label from form1 to form2 and then later back again. If anyone can help it would be greatly appreciated. Thank You!

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        This is so wrong. You shouldn't be moving controls between forms, the controls shoudn't even be visible between forms. What a disaster. To communicate between forms ( passing text to set labels, for example ), form2 can expose a property that form1 sets ( a string that sets the label ), form2 can take the string in it's constructor, or you can set up delegates to pass the info between forms based on some event in one form.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        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