Paasing the name of a TChart into a variable

TeeChart for ActiveX, COM and ASP
Post Reply
DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

Paasing the name of a TChart into a variable

Post by DJ200 » Tue Dec 08, 2009 4:43 pm

I have a small problem that I hope that you can help me with.

Using VB6

I have a graphical report that shows blood test median results/reagent used used by a participant in a QA scheme on 1 to 12 graphs.
Not all participant report all 12 tests, some only report 3 or 7 etc. So it can look messy if I have blank graphs interspersed with filled in graphs etc.

The report holds 12 TCharts to hold the results of 12 tests if they are done..but as I said, some participants may only do a few tests, and are therefore not interested in the other results

To avoid big gaps between graphs with results and graphs without result, I have devise a function to place filled graphs in a clean and logical order on the report depending upon which tests have results (determined by previous filled in graphs recordsets), and hide those that are not needed.

My problem is, I want to position my filled graph in a specific place if it has been filled. So, I use a position counting variable which tells the graph where to be placed...based upon a previous boolean value that indicates the last test graph that has data). But..how do I pass the TChart name to a variable and have it read by my function?

Example;

Private Sub SomeTest
Dim varTChart as ??? (??String, ??Control, ??TChart)

...
rsGeneric = someFunction.TestResults(LabID, etc)

If rsGeneric.recordcount>0 then
'*This Graph need to be shown because there are results from this participant.
..........
......
...
varTChart = "TChart5"

Call Position_Chart(varTChart , 6) '*6 is hard coded, here, but is a value determined from a variable further up in the programme)
...
...

End If

End Sub

Private Function Position_Chart(varTChart as ???, Position as Integer)

.....
...

Select Case Position
Case is = 1
With varTChart
.Top = 25 '* (as an example only)
.Left = 30 '* (as an example only)
.Visible = True
End With
...............
...........
.......

Case is = 6
With varTChart
.Top = 125 '* (as an example only)
.Left = 130 '* (as an example only)
.Visible = True
End With
...............
...........
.......

End Function

So my question is, for this example, how do I dim my varTChart so that it can be read in the function and placed where I want it?

Thank you for any help that you can give.

Best regards
David

DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

Re: Paasing the name of a TChart into a variable

Post by DJ200 » Wed Dec 09, 2009 10:33 am

DOH!! got it sorted!

Post Reply