tags:

views:

243

answers:

1

public int Set(int newValue,Object obj) { //System.Windows.Forms.Control ctrl = (System.Windows.FormsControl)Object; }

The Object here is COM object. Now I want to convert it to some .Net object and get hold of it's properties. What is the easiest way to do it?

A: 

You can't convert a COM object into a Windows.Forms.Control object directly. It isn't that specific type.

The COM object should, if you use the correct type library, provide you with properties of its own. You should be able to use its properties directly, provided you cast it to the appropriate type.

Reed Copsey
Set obj1 = SwfWindow("Form1").SwfObject("radioGroup").ObjectSet obj = DotNetFactory.CreateInstance("QTCustServer.RadioGroupSrv1", "C:....My Documents/Visual Studio 2005/Projects/QuickTestCustomServer2/bin/CustServer.dll")obj.Set 20,obj1...here obj1 is the COM object I'm passing to Set method. I know it's a radioGroup control but I can not cast it directly as you said. What would be the appropriate type to cast it to?
Learner
I'm using vbscript in QTP to call the .net dll
Learner