T
Tim Greenwood
I was wondering how to go about looking at an executing assembly and getting
a list of not all types but all instantiated types and references to those
objects. Something similar to what the propertygrid in Visual Studio is
doing....I need to provide property grid like functionality for one of our
internal apps.
The snippet below shows what I've done which gives me a list of all the
types in the assembly...great. Now how do I conjure up a reference to an
instance of one of these types? I don't want to create a new one, I want to
find the ones already running so the users can see the runtime properties of
their UI.
---------------------------------------------------------------------------------
private Type[] tArray;
Module[] moduleArray;
Module modCurrent;
public propgrid()
{
InitializeComponent();
}
private void propgrid_Load(object sender, EventArgs e)
{
moduleArray = Assembly.GetExecutingAssembly().GetModules(false);
this.cboModules.DataSource = moduleArray;
}
private void cboModules_SelectedIndexChanged(object sender,
EventArgs e)
{
if (!cboModules.Focused) return;
if (cboModules.SelectedIndex == null) return;
modCurrent = moduleArray[cboModules.SelectedIndex];
tArray = modCurrent.FindTypes(Module.FilterTypeName, "*");
cboObjects.DataSource = tArray;
---------------------------------------------------------------------------------
a list of not all types but all instantiated types and references to those
objects. Something similar to what the propertygrid in Visual Studio is
doing....I need to provide property grid like functionality for one of our
internal apps.
The snippet below shows what I've done which gives me a list of all the
types in the assembly...great. Now how do I conjure up a reference to an
instance of one of these types? I don't want to create a new one, I want to
find the ones already running so the users can see the runtime properties of
their UI.
---------------------------------------------------------------------------------
private Type[] tArray;
Module[] moduleArray;
Module modCurrent;
public propgrid()
{
InitializeComponent();
}
private void propgrid_Load(object sender, EventArgs e)
{
moduleArray = Assembly.GetExecutingAssembly().GetModules(false);
this.cboModules.DataSource = moduleArray;
}
private void cboModules_SelectedIndexChanged(object sender,
EventArgs e)
{
if (!cboModules.Focused) return;
if (cboModules.SelectedIndex == null) return;
modCurrent = moduleArray[cboModules.SelectedIndex];
tArray = modCurrent.FindTypes(Module.FilterTypeName, "*");
cboObjects.DataSource = tArray;
---------------------------------------------------------------------------------