Is there a way for the code below to work
as a smart device application?
It would seem that I have no access to the
GetTypeFromProgID() method.

Dim oType As Type
oType = Type.GetTypeFromProgID("Person.Bean.1")

If IsNothing(oType) Then
TextBox1.Text = "Type not found"
Exit Sub
End If

Dim oObj As Object
oObj = Activator.CreateInstance(oType)

If IsNothing(oObj) Then
TextBox1.Text = "Unable to instantiate object"
Exit Sub
End If

Dim oArgs(0) As Object
oArgs(0) = "Kenneth"
oType.InvokeMember("setFirstName",
Reflection.BindingFlags.InvokeMethod, Nothing, oObj, oArgs)
oArgs(0) = "Baylosis"
oType.InvokeMember("setFirstName",
Reflection.BindingFlags.InvokeMethod, Nothing, oObj, oArgs)

TextBox1.Text = oType.InvokeMember("getName",
Reflection.BindingFlags.InvokeMethod, Nothing, oObj,
Nothing)

oObj = Nothing
oType = Nothing

Re: using COM in a .NET smart device app by Alex

Alex
Thu Dec 11 01:02:28 CST 2003

Nope. COM Interop is not supported in Compact Framework.

"keen§" <kennethb@info.com.ph> wrote in message
news:066401c3bfb2$eeeb5570$a501280a@phx.gbl...
> Is there a way for the code below to work
> as a smart device application?
> It would seem that I have no access to the
> GetTypeFromProgID() method.
>
> Dim oType As Type
> oType = Type.GetTypeFromProgID("Person.Bean.1")
>
> If IsNothing(oType) Then
> TextBox1.Text = "Type not found"
> Exit Sub
> End If
>
> Dim oObj As Object
> oObj = Activator.CreateInstance(oType)
>
> If IsNothing(oObj) Then
> TextBox1.Text = "Unable to instantiate object"
> Exit Sub
> End If
>
> Dim oArgs(0) As Object
> oArgs(0) = "Kenneth"
> oType.InvokeMember("setFirstName",
> Reflection.BindingFlags.InvokeMethod, Nothing, oObj, oArgs)
> oArgs(0) = "Baylosis"
> oType.InvokeMember("setFirstName",
> Reflection.BindingFlags.InvokeMethod, Nothing, oObj, oArgs)
>
> TextBox1.Text = oType.InvokeMember("getName",
> Reflection.BindingFlags.InvokeMethod, Nothing, oObj,
> Nothing)
>
> oObj = Nothing
> oType = Nothing