I am not sure if I am on right way to prove this concept. Here is the situation, I am trying to solve.
I have one WinForms project (VB.Net) and there is on form called frmMain.vb
. It has designer class called frmMain.Designer.vb
. I placed one ListView
control on that form and set some static item collection to its Items
property.
I am calling this WinForm assembly into one C# console application using Reflection
. I wan to get list of items of that particulat ListView
.
Assembly AssemblyObject = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "/WinForms.exe");
if (AssemblyObject != null)
{
Type ExceptedType = AssemblyObject.GetTypes().ToList().Where(a => a.Name == "frmMain").FirstOrDefault();
if (ExceptedType != null)
{
MemberInfo members = ((TypeInfo)ExceptedType).DeclaredMembers.Where(x => x.Name == "ListView").FirstOrDefault();
}
}
Aucun commentaire:
Enregistrer un commentaire