Matt,
This helps because now I know I can create new instances of controls, but I would only be doing this to hold several (usually about 100) instances of the CWPlots and CWAnnotations objects, specifically. I only need one instance of the CWGraph control for the user, I would like to be able to display one of ~100++ CWPlots objects on this one display.
One can surmise that the overhead of even 100 instances of CWGraph objects (all hidden, used only to store CWPlots and CWAnnotations) will not be a desirable amount. Especially when you consider that I will have multiple instances of these forms at one time.
I want to be able to do this:
where data() is an array containing a Type object containing (among other things): xPlots As Collection, xAnnotations As Collection
and, for the sake of example here, aPlots As CWPlots, aAnnotations As CWAnnotations
For i = 0 To UBound(data)
With data(i)
Set .xPlots = New Collection
Set .xAnnotations = New Collection
CwGraph1.Plots.RemoveAll
' attempt 1:
.xPlots.Add
.xPlots.Item(1) = New CWPlot
' New CWPlot causes error
' "Invalid use of New keyword"
' attempt 2:
.xPlots.Add CWGraph1.Plots.Add
' No error, but points to same CWPlot
.xPlots(1).Name = "blah"
CWGraph1.Plots.Remove(1)
' Now the CWPlot object is destroyed,
' the .xPlots references nothing
.xPlots(1).Name = "blah"
' this causes Run-time error 5,
' "Can't access item"
' attempt 3:
Set .aPlots = New CWPlots
' "Invalid use of New keyword"
' attempt 4:
.aPlots = CWGraph1.Plots
' I wish I coudl do this...error.
End With
Next i
I *could* do this (ugh):
for i = 0 to UBound(data) ' goes to about 100
With data(i)
Set .xPlots = New Collection
Load CWGraph1(i)
CWGraph1(i).Visible = False
.xPlots.Add CWGraph1(i).Plots.Add
' now xPlots references an instance of CWPlots,
' but I have to keep this control [CWGraph1(i)] alive
' so now I have ~100 CWGraph controls hidden...
End With
Next i
In summation:
CWPlots just holds data. I want to store a lot of different instances of this data without having to pull the individual elements (of which there are many).
I hope this clarifies my conundrum.
I probably could also do a CWGraph1.Plots.Add for each plot I need (about 2-3 for each Plots object), but I imagine that the CWGraph control wouldn't do very well with 900 Plots objects (all but 3 hidden).
Is there a correlation between overhead and the amount of CWPlot's in a CWGraph.Plots CWPlots collection?
Adam Rofer
Plantronics, Inc.