Two Instances of a Form

Here's my code:


Public frmQTemps() As QTemps

Code in my Main Form:

        ReDim frmQTemps(SSTab1.Tabs)
        Set frmQTemps(SSTab1.Tab) = New QTemps
        Load frmQTemps(SSTab1.Tab)
        frmQTemps(SSTab1.Tab).Tag = CStr(SSTab1.Tab)
        frmQTemps(SSTab1.Tab).Caption = "Temperature for Q" & qsntxt(SSTab1.Tab).Text

I have this form QTemps that I will be loading several instances of.  Now, I want to be able to tie each instance to a specific tab on my main form.  Now, this method let's me do that to a certain extent.  Once I have two tabs and load two instances of this form and start them both processing my task, I get stopped.  My winsock control array for each tab complains with:
Run-Time Error 91.  Object variable or With block variable not set.

This is at a point where i'm referencing an object on the QTemps forms that I have loaded.  But it only seems to happen when I get them both processing at the same time.  Any ideas, thoughts?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brendt HessSenior DBACommented:
When adding a second form to your array, you need to REDIM PRESERVE, not just REDIM:

      ReDim Preserve frmQTemps(SSTab1.Tabs)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Is your Winsock control on the main form? How are you referencing it on the other forms?
KS_RobertAuthor Commented:
I knew this already, but I had forgot all about it.  Thanks for the reminder!
Good job, bhess1 -- I thought of that a split second after you did. Nice 2000 points! More than I made all week!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.