Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically adding a scattergraph control - advice needed.

This may not be the right forum for this so forgive me if I have posted this to the wrong place.  The questions refers to vb.net, Measurement Studio 8.1.0 and adding controls dynamically.

I need to create scattergraph at runtime and I can not figure out how to programatically add a scattergraph to an existing control (say, a tab control). There is one scattergraph to start, but during execution the user can choose to add more graphs so I need to add them as the user requests them.  The control.add (and .addRange) method takes a parameter which is a system.windows.forms.control but the NI scattergraph is not derived from this so the compiler complains.  I thought about cloning the control but scattergraph doesn't support this.  I tried type casting the control (a long shot) and that didn't work.

I am looking for a way (perferably code samples) to show me how to programatically add a scattergraph control to a vb.net program.  I have found several examples that show how to add system.windows.forms.contol objects, (specifically, http://msdn.microsoft.com/msdnmag/issues/04/01/AdvancedBasics/) but as I explained, that doesn't seem to work in my case. Anyone have any ideas?

Thanks,
-Steve
0 Kudos
Message 1 of 3
(3,176 Views)
Hey Steve,

If you are using vb.net, you could create a new ScatterGraph control and then add it to the control array of your desired TabPage control.  See the following code snippet for an example of how to do this.

Dim newGraph As ScatterGraph
newGraph = New ScatterGraph
TabControl1.TabPages(0).Controls.Add(newGraph)


I hope this helps!


Message Edited by JettR on 01-03-2008 06:00 PM
Best Regards,
Software Engineer
Jett R
0 Kudos
Message 2 of 3
(3,166 Views)
Thank you JettR, that helped.  I was making the problem harder than it was.  I'm adding it to a FlowControlPanel and its working.  I just need to clean things up a bit, add axes, etc.  Thanks again.
0 Kudos
Message 3 of 3
(3,156 Views)