cable beach
Posts
-
Quering a COM object in .net -
Quering a COM object in .netThanks for the answer, but in order to cast, you need to have a type to cast to. In this case, the variable being passed (as an object), is actually a vb6 form, and to get the type means that I need a reference to the vb6 dll, and the form needs to be an exported type. If I was using VB.net (and I have tried this), I can just reference properties of the object without casting, or creating a reference, presumably using late binding to query the object at runtime "under the bonnet" - this is all taken care of for the VB developer. My question is: how can I do the same thing in c#? To clarify the sample code: VB6 code:
dim obj as MREPlugin32.MREPlugin ... set obj = new MREPlugin32.MREPlugin obj.Init(Me)
VB.net code (this works):public Sub Init(obj as Object) dim location as string = obj.Location End Sub
So how can I do this? C# Code:public Void Init(object obj) { string location = obj.Location; // Somehow, without any external references. }
-
Quering a COM object in .netI support an application that is a combination of vb6 and .net components. I am trying to replace a vb6 dll with an equivalent in c# but I've got stuck on how to query the properties of a com object that is passed as Object. The vb6 form instantiates a .net object through COM and then passes a reference to itself but as an object, not a specific type:
public bool Init(ref ADOConn.STConnector db, object MREForm, string user)
In VB i could query any public variables on the form for example:
dim loc as string = MREForm.Location
If I use reflection, all I get is the properties of the object type, not the underlying COM type. How can I do the same thing in C#? Thanks for any help on this. -
To test a theory. (Shared Birthdays)Actually, i think they share the same month, not the exact date. This is a theory of combinatorics (the pigeon hole principle) rather than probability. In any event: 13th February