|
-
Apr 8th, 2009, 07:39 AM
#1
Thread Starter
Hyperactive Member
set item property values dynamically?
hi all,
i'm trying to create a procedure that changes an items property value dynamically.
something like...
Code:
Public Sub SetItemProperty(ByVal item_name As String, ByVal property_name As String, ByVal value As String)
item_name.property_name = value
End Sub
'Call it by.
SetItemProperty("Textbox1", "Text", "Hello World")
but of course that's just a sample of what i want to accomplish..
i'd appreciate any help.
thanks.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Apr 8th, 2009, 07:53 AM
#2
Re: set item property values dynamically?
You'd have to use reflection to accomplish that, search this forum for "Reflection Set Property" or something similar.
Edit: I feel generous today, so I searched for you
-
Apr 8th, 2009, 08:56 AM
#3
Thread Starter
Hyperactive Member
Re: set item property values dynamically?
hi,
thanks for the link... very informative.
but the approach might not be applicable to my situation.
forgive me if i didn't mention this earlier but the situation i am in right now is that i am planning to create this procedure inside an interface... which is why i planned to pass the control/item as string type instead of control type.
what work-arounds can i do for this?
thanks
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Apr 8th, 2009, 08:59 AM
#4
Re: set item property values dynamically?
I may be mistaken, but I'd suggest that you explain your ultimate objective more thoroughly, as I feel that you have backed yourself into a corner from which any solution, if one exists, will be very difficult to create or maintain.
My usual boring signature: Nothing
 
-
Apr 8th, 2009, 05:44 PM
#5
Thread Starter
Hyperactive Member
Re: set item property values dynamically?
 Originally Posted by Shaggy Hiker
I may be mistaken, but I'd suggest that you explain your ultimate objective more thoroughly, as I feel that you have backed yourself into a corner from which any solution, if one exists, will be very difficult to create or maintain.
hi,
to explain further, i have here a plugin architecture.. i have an MdiForm as the executable file.. then i have a couple of dll that has child forms and are loaded at runtime. i have reach the point where these child forms will need to modify items in the MdiForm like for example, I have a toolstrip on the MdiForm and it has a few ToolStripButtons. not all these buttons are enabled in every child form. some are disabled. so in my child form, i'm trying to find a way to disable the ToolStripButtons that are not required.
i've thought of using another Interface for this as well and create procedures for each item but this will lead to a lot of codes. which is why i thought maybe i can use the approach i mentioned above which is to just use a procedure that can change item properties in the MdiForm dynamically just by specifying the item / control name, what property and the value.
i'm not sure if it's possible thought.
thanks.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Apr 8th, 2009, 07:56 PM
#6
Re: set item property values dynamically?
Your plugin interface should define a property that the parent form can read to determine which tool buttons and menu items should be enabled. It should also define an event that provides a notification when this property value has changed. The parent form can then read that property value and set the state of its own menus and tool bars.
-
Jul 7th, 2009, 02:57 AM
#7
Thread Starter
Hyperactive Member
Re: set item property values dynamically?
thanks..
haven't had the chance to try this yet.
will get back to you.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|