Link to home
Start Free TrialLog in
Avatar of KS_Robert
KS_Robert

asked on

Two Instances of a Form

Here's my code:

Declarations:

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
        frmQTemps(SSTab1.Tab).Show

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?

Thanks,
Robert
ASKER CERTIFIED SOLUTION
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GivenRandy
GivenRandy

Is your Winsock control on the main form? How are you referencing it on the other forms?
Avatar of KS_Robert

ASKER

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!