[2005] What's the .NET way of instantiating
I'm trying to follow some instructions written for VB6 to integrate eye tracking API's into a .NET program. I just need help with 2 lines of the code:
The simple instructions are as follows:
Add a library reference to the Eye tracker Components 1.X Type Library (DONE)
Add a new TetCalibPlot control to the form, and name it tcpTetCalibPlot (DONE)
To access the ITetCalibPlot interface, declare and instantiate:
VB Code:
Dim m_tetCalibPlot As ITetCalibPlot
Set m_tetCalibPlot = tcpTetCalibPlot.Object
I've added the reference, added the control and named it. I just don't know what the equivalent code in .NET would be for the setting of the object. Can someone help.
Thanks,
Re: [2005] What's the .NET way of instantiating
I think that you want this:
VB Code:
Dim m_tetCalibPlot As New ITetCalibPlot
This should give you a clean object to work with.
D
Re: [2005] What's the .NET way of instantiating
Set is no longer used for reference assignment. Also, in VB.NET you can declare and assign in one statement, which is advisable.
VB Code:
Dim m_tetCalibPlot As ITetCalibPlot = tcpTetCalibPlot.Object
By the way, it's not instantiation, just assignment. Instantiation would be as dminder suggested; although, since ITetCalibPlot is an interface, instantiating it would neither work nor make sense.
Re: [2005] What's the .NET way of instantiating
Instantiate = Their words/guide not mine. I think their translation from it's original Swedish into English needs more work. It's all a bit of a nightmare.
I'm afraid neither works though: I get this error with regards to the last post:
Object is not a member of AxTetComp.AxTetCalibPlot
EDIT:
If i remove the .Object part I then get this error:
Unable to cast object of type 'AxTetComp.AxTetCalibPlot' to type 'TetComp.ITetCalibPlot'.
Any ideas?
Re: [2005] What's the .NET way of instantiating
Quote:
Originally Posted by stimbo
Instantiate = Their words/guide not mine. I think their translation from it's original Swedish into English needs more work. It's all a bit of a nightmare.
I'm afraid neither works though: I get this error with regards to the last post:
Object is not a member of AxTetComp.AxTetCalibPlot
wooh! go sweden! ;)
Re: [2005] What's the .NET way of instantiating
At this point in time it's more "Go Away Sweden" than "Go Sweden" :D
Re: [2005] What's the .NET way of instantiating
After re-reading the entire post and not just the code, am I correc that this is a custom control that is added to the project? If so, then I think that because it is a custom control you added to the form, you should not need to make any reference to it in code. If there are properties that need set before it can be used then set them in design or during the Form's/controls Load procedure.....
D
Re: [2005] What's the .NET way of instantiating
I think it's solved:
VB Code:
Dim m_tetCalibPlot As ITetCalibPlot = tcpTetCalibPlot.GetOcx
I just kept trying things until it stopped giving me error messages. Think i beat it into submission. The guy with complete access to the system has gone home so i'll have to try it tomorrow but the proper calibration screen has loaded with the correct number of points on it so that should be it. No idea why but I'll look into it more tomorrow. I've had it for the day.