Results 1 to 2 of 2

Thread: object instance reference from another form

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    61

    object instance reference from another form

    Greetings.
    I have a two form application and need to access an instance of an object from another form. I dont want to create the new form (allready created) and dont need to create the object again.
    example
    Public Class Form1{
    Public A as myobject
    A = New myobject
    ...
    ... 'change properties of the instance of the object. i want those passed
    ...
    }

    Public Class Form2{
    A.someproperty = value
    }
    I need to do that.
    I think i need to create a reference of the object A for the Form2 but i dont want to create a new object. I need to have the instance as it has been modified from Form1.
    Another issue that i think might be a problem (or not...just a thought) is that object A handles some events in Form1. Although i dont need to do that in form2. I just need to obtain some values of the object.
    Any suggestions?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: object instance reference from another form

    I suggest that you read the Forms in VB.NET tutorial in my signature. It should answer this and many other questions.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width