This part is easy:
Dim oControl As Control
oControl = Me.Page.FindCon trol("TextBox1" )
Dim oPropertyInfo As PropertyInfo
oPropertyInfo = oControl.GetTyp e.GetProperty(" Text")
oPropertyInfo.S etValue(oContro l, "Some New Text", Nothing)
What about in the case when the property may have properties that need to be
changed?
For instance the Infragistics WebTextEdit control, I couldn't quickly find a
vb control example, has a property named "ButtonsAppeara nce" which has a
property named "CustomButtonTo olTip". The following code produces a
targetexception .
oControl = Me.Page.FindCon trol("WebTextEd it1")
Dim oPropertyInfo As PropertyInfo
oPropertyInfo = oControl.GetTyp e.GetProperty(" ButtonsAppearan ce")
oPropertyInfo =
oPropertyInfo.P ropertyType.Get Property("Custo mButtonTooltip" )
oPropertyInfo.S etValue(oContro l, "Some New Text", Nothing)
I don't believe oControl is the correct target here but am at a loss as to
how to provide the correct target. Any suggestions? 1 3952
I wanted to pass on what I have found.
The ButtonsAppearan ce Property is READ ONLY. So is every other Property
whose Value is not a value type; I only perused Visual Studio and
Infragistics controls. Therefore it will not be possible to make changes to
these properties at runtime. If anyone resolves the TargetException , I'd be
interested in seeing the code.
"Paul" <pa*******@smmo ving.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. This part is easy: Dim oControl As Control
oControl = Me.Page.FindCon trol("TextBox1" )
Dim oPropertyInfo As PropertyInfo
oPropertyInfo = oControl.GetTyp e.GetProperty(" Text")
oPropertyInfo.S etValue(oContro l, "Some New Text", Nothing)
What about in the case when the property may have properties that need to
be changed?
For instance the Infragistics WebTextEdit control, I couldn't quickly find
a vb control example, has a property named "ButtonsAppeara nce" which has a property named "CustomButtonTo olTip". The following code produces a targetexception .
oControl = Me.Page.FindCon trol("WebTextEd it1")
Dim oPropertyInfo As PropertyInfo
oPropertyInfo = oControl.GetTyp e.GetProperty(" ButtonsAppearan ce")
oPropertyInfo = oPropertyInfo.P ropertyType.Get Property("Custo mButtonTooltip" )
oPropertyInfo.S etValue(oContro l, "Some New Text", Nothing)
I don't believe oControl is the correct target here but am at a loss as to how to provide the correct target. Any suggestions?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Tullemans |
last post by:
I am trying to write a subroutine that will examine all
the properties of a form to determine which of those are
SqlCommand objects, and then set the Connection property
of those SqlCommands to a passed-in SqlCommand object. I
can find the properties OK but am unsuccessful in trying
to change their value due to the way I have identified
those SqlCommand objects (as a PropertyInfo). Can anyone
give me a hint (or suggest a better way) as...
|
by: Hugo Leonardo |
last post by:
I'll big problem.
I have tree class:
public Class Column
{
public Column
{...}
string _Value;
public bool HasValue = false;
|
by: Bob |
last post by:
This works only when the property return type is string:
SomeObjectsPropertyInfo.SetValue(SomeObject, SomeStringValue, Nothing)
Is there a good way to try to automatically cast the string value I'm trying to
pass into SetValue as the correct type?
Bob
|
by: Charles Law |
last post by:
I have adapted the following code from the MSDN help for PropertyInfo
SetValue. In the original code, the structure MyStructure is defined as a
class MyProperty, and it works as expected. There is also a minor change in
class Mypropertyinfo, which I have commented out.
When using a structure, however, the second call to GetValue returns
"Default caption". Can anyone tell me why, and how I can make this work?
<code>
Imports System
|
by: ThisBytes5 |
last post by:
I am trying to save/retreive some settings from a database using
reflection an my custom attributes. The field in teh database is a
string, but my property is a boolen. I have the following code:
pi.SetValue(settingsObject, GetSettingFromDb(attribute.SettingName),
null);
When I run this, I receive the following error:
| |
by: tatilou |
last post by:
Hello,
I need add new method to my properties. these methods should give me
some attributes coming from my database.
I think, to create a class with implement PropertyInfo but I don't know
how To call my custom class.
My code like this :
public abstract class Class2 : PropertyInfo //, RuntimePropertyInfo
|
by: Carlos Rodriguez |
last post by:
I have the following function in C#public void Undo(IDesignerHost host)
{
if (!this.componentName.Equals(string.Empty) && (this.member != null))
{
IContainer container1 = (IContainer)
host.GetService(typeof(IContainer));
IComponent component1 =
container1.Components;
PropertyInfo info1 =
component1.GetType().GetProperty(this.member.Name);
|
by: FourEyes |
last post by:
I've read that Reflection is slow and shouldn't be used when
performance is a concern. In my case, performance is definitely a
concern, so I was thinking that I could collect the PropertyInfo
objects that I need at initialization, and then just call
PropertyInfo.SetValue() at runtime. Can anyone tell me 1) how
expensive is the call to PropertyInfo.SetValue() ? and 2) what is a
better alternative ?
I already have a hand-made solution...
|
by: damiensawyer |
last post by:
Hi,
I need to invoke .getvalue and .setvalue on fieldinfo and propetyinfo
objects. Even though they're both derived from MemberInfo, they don't
share those two methods. I've finding myself writing the following
types of structure over and over. Is there something I'm missing? Or
some 'funky' 3.5 delegate/lambda expression way of doing this?
Thanks very much in advance,
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |