Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 30th, 2004, 10:02 AM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object Reference

I have a base class (CAHG.vb) that contains a modular collection variable (mCurMembers). A sub routine (GetEligibility) within the base class populates this collection.

I also have a new class (CVendor.vb) that inherits the base class and also has 5 new modular collection variables (i.e mRobinsonMembers). There is a sub routine in CVendor that calls GetEligibility which in turn populates mCurMembers.

What I would like to do is create a local variable in the subroutine that is a reference to the appropriate collection object in CVendor. I then want to set this reference object equal to mCurMembers in order to copy the content over.

Any ideas? Passing in a variable byref is not an option. Thanks in advance.
 
Old May 1st, 2004, 08:25 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I don't understand what your intention is. But from what I read it sounds like you want to do this:

Sub GetEligibility()
   Dim objCollectionReference
   objCollectionReference = mCurMembers
End Sub

Is this what you want?
 
Old May 3rd, 2004, 08:07 AM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That didn't work. That was my original solution. I ended up figuring it out already. I'm not sure where my head was Friday.

My abbreviated solution ended up looking like this:
Protected mCubaMembers,mRobinsonMembers as new collection

Private Sub FillCollection()

    dim Index as integer
    dim colRecords as collection

    Select Case Index
        case 1
            colRecords = mRobinsonMembers
        case 2
            colRecords = mCubaMembers
    End Select

    dim Record as CAHG.Record
    For Each record in mCurMembers
        colRecords.add(record)
    Next
End Sub

Thanks for your help anyway.





Similar Threads
Thread Thread Starter Forum Replies Last Post
object reference not set to instant of an object shahidrasul ASP.NET 2.0 Basics 1 September 5th, 2008 02:01 PM
Object Reference not set to an instance of object srinivas_chakka ASP.NET 1.0 and 1.1 Professional 0 February 8th, 2006 11:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.