|
-
Jan 9th, 2007, 10:31 AM
#1
Thread Starter
Frenzied Member
[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,
-
Jan 9th, 2007, 10:35 AM
#2
Fanatic Member
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
-
Jan 9th, 2007, 10:42 AM
#3
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.
-
Jan 9th, 2007, 11:02 AM
#4
Thread Starter
Frenzied Member
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?
Last edited by stimbo; Jan 9th, 2007 at 11:11 AM.
-
Jan 9th, 2007, 11:07 AM
#5
Re: [2005] What's the .NET way of instantiating
 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!
-
Jan 9th, 2007, 11:12 AM
#6
Thread Starter
Frenzied Member
Re: [2005] What's the .NET way of instantiating
At this point in time it's more "Go Away Sweden" than "Go Sweden"
-
Jan 9th, 2007, 11:14 AM
#7
Fanatic Member
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
-
Jan 9th, 2007, 12:12 PM
#8
Thread Starter
Frenzied Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|