S
Steve
Seems like it should be simple. I found an article on
MSDN(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/
html/frlrfsystemwindowsformsbindingclasstopic.asp) that explains doing it
with a DataSet.
I'm using a custom object with a couple of string members. I can't believe
that databinding is an incredibly complex as it appears to be. From what I
have read, it would be much simpler to manually maintain the relationships
between control and data.
I must be missing something. Given a class;
<code>
public class CMyClass
{
private string m_name;
// ctor code...
public string Name
{
get{ return m_name; }
}
}
</code>
If I wanted to bind that Name property to a text control, I would think it
would be as simple as;
CMyClass c - new CMyClass();
textBox1.DataBindings.Add( new Binding("Text", c, Name));
or even:
textBox1.DataBindings.Add( new Binding("Text", c, c.Name));
This throws exceptions that it can't find the data member. After
researching it looks like my CMyClass needs to implement IBindingList or
ITypedList
yuck, those are big interfaces.
This wasn't intended to be a complain fest, I'm just surprised, it's SOOO
much easier on WebForms. I must be missing something. Please, someone...
guide me
MSDN(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/
html/frlrfsystemwindowsformsbindingclasstopic.asp) that explains doing it
with a DataSet.
I'm using a custom object with a couple of string members. I can't believe
that databinding is an incredibly complex as it appears to be. From what I
have read, it would be much simpler to manually maintain the relationships
between control and data.
I must be missing something. Given a class;
<code>
public class CMyClass
{
private string m_name;
// ctor code...
public string Name
{
get{ return m_name; }
}
}
</code>
If I wanted to bind that Name property to a text control, I would think it
would be as simple as;
CMyClass c - new CMyClass();
textBox1.DataBindings.Add( new Binding("Text", c, Name));
or even:
textBox1.DataBindings.Add( new Binding("Text", c, c.Name));
This throws exceptions that it can't find the data member. After
researching it looks like my CMyClass needs to implement IBindingList or
ITypedList
yuck, those are big interfaces.
This wasn't intended to be a complain fest, I'm just surprised, it's SOOO
much easier on WebForms. I must be missing something. Please, someone...
guide me