Databinding with reflection
I have a class, SmartString:
Public Class SmartString
...Psuedo code follows
Public Property Value() as String
Return Me.Text
End Property
Public Property IsNotNothing() as Boolean
Return m_IsNotNothing
End Property
End Class
Then, I have a Main Class:
Public Class MyClass
...Psuedo code follows
Public Property SPECIAL_TEXT() as SmartString
Get
Return m_SpecialText
End Get
Set(ByVal Value as SmartString)
m_SpecialText = Value
End Set
End Property
End Class
Then, on another form, I'm using reflection to dynamically create
labels and textboxes to display.
Dim obj as Object = Activator.Creat eInstance(MyCla ss)
Dim pInfoArray() as PropertyInfo
For Each pInfo as PropertyInfo in pInfoArray
Dim NewTextBox as TextBox
NewTextBox.Name = pInfo.Name
NewTextBox.Data Bindings.Add("T ext", obj, pInfo.Name & ".Value")
NewTextBox.Data Bindings.Add("E nabled", obj, pInfo.Name &
".IsNotNothing" )
Me.Controls.Add (NewTextBox)
Next
The above code throws an error. What I'm trying to do is Bind the
TextBox's "Text" field to the Value field of the SmartDate Property
(SPECIAL_TEXT), and the TextBox's "Enabled" field to the IsNotNothing
field of the SmartDate Property (SPECIAL_TEXT).
If SPECIAL_TEXT was just of type "String", then I could add the
databinding simply by calling NewTextBox.Data Bindings.Add("T ext", obj,
pInfo.Name).
How can I bind when SPECIAL_TEXT is of the type SmartString?
Thanks for any help anyone can provide.
-Jason 0 1245 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Wiktor Zychla |
last post by:
Hello,
I am thinking of a general solution to the specific issue and I hope
someone has some more experience on that.
Up to now I use the ListView as the primary control for collections of
items. Unfortunately, the ListView behaves sluggishly with large amounts of
data. That's why I think of using DataGrid instead.
The DataGrid in my application should be databinded to a memory
|
by: Kevin Swanson |
last post by:
I'm writing what should be a very simple app against an Oracle database. The
app has a number of user controls, any one of which is loaded into a main
display page using the loadControl method, depending on which menu item a
user selects. Each of these controls follows the same basic pattern: Get a
dataset from the database and then display the results using basic
databinding.
Everything works fine except that I'll occaisionally get an...
|
by: udupi_mail |
last post by:
Can anybody suggest possible databinding options which would bind(map)
xml instance docs(which conforms to some pre-defined xsd) to a
PRE-EXISTING java object (see below example). I looked at xstream which
seems to be a good option for serializing/deserializing objects to xml
and vice-versa(xstream does not care for schemas). Same with JAXB,
Castor or Xmlbeans ..I have not found a way to map the below xml to my
custom java obj?
Any...
|
by: Dirk |
last post by:
Hello,
I have a problem to use databinding with my business layer classes. My
data class does not have simple properties (string, int or datetime),
instead, all my properties are objects of the generic type Field<T>
(see sample code).
public class Employee
{
public Field<stringForename
|
by: udupi_mail |
last post by:
Hello,
Was hoping to get some feeback on the following:
Current arch. is a swing client with corba services deployed on AIX.
Data tranferred over the wire is XML(string) instead of traditional
corba datatransfer objects. The corba interface just provides business
methods which take in a parameter of type java.lang.String(xml).
We are using a DOM based xml serializer/deserializer which does the
java<-->xml conversion both on client and...
| |
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= |
last post by:
Hello to all,
I want to know if DataBinding in asp.net 2,0 is better than to fill up the
values of the controls of the following form:
this.miControlTextBox.Text = valorParaControlTextbox;
Performance with databinding is good in asp.net 2.0 ? Would you prefer:
databinding or set value to Text property of control ?
|
by: Mauro D. |
last post by:
Hi,
In my usercontrol I bind the BindingSource I pass via property to all
the control inside the usercontrol.
For example
Control ctl=new TextBox();
ctl.DataBindings.Add("Text", binding, prop, false,
DataSourceUpdateMode.OnPropertyChanged);
|
by: cjard |
last post by:
I ask, because I have a textbox bound to a bindingsource, which is
bound to a datatable(row)
The datatable is typed, and hence exports a Property called Column1
I added another property to the datatable by editing the partial
class, and Called it ColumnX - it simply returns "Hello World" all the
time
Then I tried to bind my textbox to it, editing the binding for .Text
from xyzBindingSource - Column1
|
by: Matt |
last post by:
Hi,
Is it possible to write a method which can take both a normal
instansiated type and reflection instansiated type?
For example, the following code doesn't work. It throws a casting
exception claiming that a type cannot be converted to another type
(they are both the same reported type - RoundedRectangle):
///code that sets classThatImplementsFactorySuppliedInterface by
|
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: 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: 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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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.
| |