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 3940
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...
|
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...
|
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...
|
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?...
|
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...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
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.
| |