473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Reflection of a COM object

I have a complex Com object that I want to interrogate to discover the
prperties of to allow me to save/restore it's state between instances.
I have been able to accomplish this with the top level items using the
following

Private Sub InterrogateBlob(ByVal blob As Object)
Dim blobfeaturelist As
Matrox.ActiveMIL.BlobAnalysis.BlobFeatureListClass
blobfeaturelist = blob.FeatureList
Dim instancemembers As MemberInfo() =
blobfeaturelist.GetType().GetMembers()
For Each member As MemberInfo In instancemembers
If member.MemberType = MemberTypes.Property Then
Debug.WriteLine(member.Name + " is a Property")
Dim pri As PropertyInfo = CType(member, PropertyInfo)
If pri.PropertyType.IsPrimitive Then
If member.Name <> "MilID" Then
Dim ob As Object =
blobfeaturelist.GetType().GetMember(member.Name)
Dim v As Boolean =
Convert.ToBoolean(RegKey3.GetValue(member.Name))
pri.SetValue(blobfeaturelist, v, Nothing)
End If
Else 'we need to figure out how to drill into a type that is
not primative
Dim priType As Type = pri.PropertyType
Dim priob As MemberInfo() =
instancemembers.GetType().GetMember(pri.PropertyTy pe.ToString +
"Class")
Debug.WriteLine(priType.ToString())
Dim primembers As MemberInfo() = priType.GetType.GetMembers()
For Each primember As MemberInfo In primembers
If primember.MemberType = MemberTypes.Property Then
Debug.WriteLine(" " + primember.Name + " is a
Property")
End If
Next
End If
End If
Next
End Sub

but as noted in the code I haven't been able to figure out how to work
with the properties that are not value types. How do I get a handle to
the sub types to read/restore their values also?

Nov 21 '05 #1
0 828

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
4
by: Tim Werth | last post by:
I am trying to use reflection to add an event handler for the RowUpdated event of the OracleDataAdapter object (ODP.NET), but the same thing can be said for SqlDataAdapter if you only use...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
2
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
11
by: Aaron Queenan | last post by:
Given the classes: class Class { public static implicit operator int(Class c) { return 0; } } class Holder
2
by: Jeff | last post by:
I am trying to dynamically load an assembly via reflection and then invoke a method of that assembly that will populate a custom type collection passed into the method byref. I am able to...
2
by: diego | last post by:
hi everyone, i have a sub that opens a form given the form's name as string and opens it using System.Reflection. How can I set the form's properties at runtime. Here is my code. Public Sub...
5
by: Klaudiusz Bryja | last post by:
Hi, This is for NetCF 2.0. I need to create event handling code which using reflection. I have some parameters in XML which describe how event should be handled. I have code to create...
6
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am slightly familiar with reflection but have never done the following I know how to find a class and call but I haven't done the following The Method return a List of Another Class And...
6
by: Cralis | last post by:
Hi guys, Someone once said, 'You can do that with reflection'. I can't recall what it was I was trying to do at the time, but then he said, 'Any developer knows what reflection is...'. I kept...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.