Search:
Namespaces
Discussions
.NET v1.1
Feedback
Reflection conundrum.
Messages
Related Types
This message was discovered on
ASPFriends.com 'ngfx-reflection' list
.
David Brophy
Hi,
In my infinite search to reduce the number of lines of code I write, I =
have a
problem. Consider the following situation, where I have 5 panels, names =
panelX,
with X=3D1 to 5.=20
I want to change the Visible property of each of them to true, using a =
loop.
I've invented a mythical GetObject(string objectName) function, which =
returns
a reference to the object specified by the string.
Initially, it smacks of things you can't do in compiled languages, but =
the
Reflection classes have a lot of similar functionality.=20
I'm thinking my GetObject function would be some convolution of the
Type
.InvokeMember() function, but I can't figure out how to do it.
Any help would be gratefully received.
My Code:
[Original message clipped]
- David Brophy
Director, Cambro Limited,
(023) 80 679550=20
Click here to reveal e-mail address
Reply to this message...
Andy Eunson
In a web application you can use the
Page
.FindControl method to return a
refernece to a control by name
Dim MyControl as System.Web.Ui.Control
MyControl =
Page
.FindControl("Panel1")
You could probably do something like:
Dim x as integer
Dim MyControl as System.Web.Ui.Control
For x = 1 to 5
MyControl =
Page
.FindControl( New String( "Panel" & x ) )
MyControl.Visible = False
Next
Andy
----- Original Message -----
From: "David Brophy" <
Click here to reveal e-mail address
>
To: "ngfx-reflection" <
Click here to reveal e-mail address
>
Sent: Thursday, November 01, 2001 11:17 AM
Subject: [ngfx-reflection] Reflection conundrum.
Hi,
In my infinite search to reduce the number of lines of code I write, I have
a
problem. Consider the following situation, where I have 5 panels, names
panelX,
with X=1 to 5.
I want to change the Visible property of each of them to true, using a loop.
I've invented a mythical GetObject(string objectName) function, which
returns
a reference to the object specified by the string.
Initially, it smacks of things you can't do in compiled languages, but the
Reflection classes have a lot of similar functionality.
I'm thinking my GetObject function would be some convolution of the
Type
.InvokeMember() function, but I can't figure out how to do it.
Any help would be gratefully received.
My Code:
[Original message clipped]
- David Brophy
Director, Cambro Limited,
(023) 80 679550
Click here to reveal e-mail address
| [ngfx-reflection] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngbeta.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
System.Type
System.Web.UI.Page
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com