Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 788483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:22:20+00:00 2026-05-14T21:22:20+00:00

I’m trying to use late binding to connect to a COM automation API provided

  • 0

I’m trying to use late binding to connect to a COM automation API provided by a program called Amibroker, using a C# WinForms project. So far I’ve been able to connect to everything in the API except one item, which I believe to be a “parameterized property” based on extensive Googling.

Here’s what the API specification looks like according to the docs (Full version here: http://www.amibroker.com/guide/objects.html):

Property Filter(ByVal nType  As Integer, ByVal pszCategory As String) As Long [r/w]

A javascript snippet to update the value looks like this:

AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;
AA.Filter( 0, "market" ) = 0;

Using the following C# late-binding code, I can get the value of the property, but I can’t for the life of me figure out how to set the value:

object[] parameter = new object[2];
parameter[0] = Number;
parameter[1] = Type;
object filters = _analysis.GetType().InvokeMember("Filter", BindingFlags.GetProperty, null, _analysis, parameter);

So far I have tried:

  • using BindingFlags.SetProperty, BindingFlags.SetField
  • casting the returned object to a PropertyInfo object and trying to update the value using it
  • adding extra object containing the value to the parameters object
  • various other things as last-ditch efforts

From what I can see, this should be straight-forward, but I’m finding the late binding in C# to be cumbersome at best. The property looks like a method call to me, which is what is throwing me off. How does one assign a value to a method, and what would the prototype for late-binding C# code look like for it?

Hopefully that explains it well enough, but feel free to ask if I’ve left anything unclear. Thanks in advance for any help!

Daniel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:22:20+00:00Added an answer on May 14, 2026 at 9:22 pm

    Yes, properties in COM are implemented as methods under the hood. The method name ought to be “set_Filter”. I reckon the real reason you are having a problem is because you are going by the VB6 declarations. The VB6 Long type isn’t actually a long in C#, it is an int. Trying to assign the property with a long value will fail.

    Writing this code in VB.NET could make it a lot easier, it fully supports late-bound method and property access, using the “natural” syntax similar to Java. And supports indexed properties, unlike C#. Write a little wrapper assembly that you can reference in your C# project. It is available in C# too since VS2010 with the new dynamic keyword.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.