Results 1 to 8 of 8

Thread: [2005] What's the .NET way of instantiating

  1. #1

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    [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:
    1. Dim m_tetCalibPlot As ITetCalibPlot
    2. 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,
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  2. #2
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    Re: [2005] What's the .NET way of instantiating

    I think that you want this:
    VB Code:
    1. Dim m_tetCalibPlot As New ITetCalibPlot
    This should give you a clean object to work with.

    D

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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:
    1. 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.

  4. #4

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    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.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  5. #5
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    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!
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  6. #6

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] What's the .NET way of instantiating

    At this point in time it's more "Go Away Sweden" than "Go Sweden"
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  7. #7
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    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

  8. #8

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] What's the .NET way of instantiating

    I think it's solved:

    VB Code:
    1. 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.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width