C# COM question

I have a dll that I use in VB 6.

I create a variable called DB, I access the records in the DB like this

DB(index).PutStringField("data")

when I try that in c# I get an error

is a 'property' but is used like a 'method'

I have no idea what to do because I have not done any COM interfacing in C#.

Is it a simple syntax problem or do I need a different version of the dll that I have always used

ANY help is greatly appreciated.



Answer this question

C# COM question

  • Belsteak

    Stephen Hauck wrote:
    I emailed you a copy of the DLL


    Could you please post the property decleration here, so other users can help you with this problem as well.

    Thanks!


  • Raphinator

    Then I’m going to suggest there is something more fundamental going on here. At least, more fundamental than pure syntax. Can you provide more information about the data types that those properties contain

    Bruce Johnson [C# MVP]
    http://www.objectsharp.com/blogs/bruce


  • MossyBlog

    Try using the Item property explicitly. I suspect that the Records class in PalmDbLib doesn’t implement a default indexer. In other words

    o.Records.Item(index)

    Bruce Johnson [C# MVP]
    http://www.objectsharp.com/blogs/bruce



  • .Net Developer & SQL DBA

    I emailed you a copy of the DLL
  • MSDev23

    Tried that too, get this error

    Error 1 Cannot apply indexing with [] to an expression of type blah blah


  • nwkrzysztf

    It’s a syntax problem. In C#, the indexer is surrounded by square brackets, not round ones.

    Bruce Johnson [C# MVP]
    http://www.objectsharp.com/blogs/bruce




  • ricky-1979

    In the object browser it shows the following

    PalmDBLib.Records Records { get; } Member of PalmDBLib.IDatabase

    The problem is that in VB it works like and index but when it is pulled into .NET it is a property.

    In VB 6 you use DatabaseVariable.Records(index) to access a specific record, in C# / .NET it does not treat it this way.

    Is there somewhere in C# that I can chage this


  • C# COM question