Question : c# Business Object Databinding

Databinding in flex is rediculously simple.

If I have an object with a property value, I can databind to a flex control by simply doing this

control.property = "{object.value}"

done.


However this doesnt seem to be as effective in c#!  I am trying the following

tbTitle.DataBindings.Add("Text", job, "Title");

If job.Title changes, the text box does not change, if the text box changes, the object property job.Title does not change.

Anyway idea what am I missing?  I have attached a code snippet of my object.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
[System.ComponentModel.Bindable(true)]
    public class Job
    {
         private string title;

         public string Title 
         {
              get { return title; }
              set { title = value; }
         }
     }

Answer : c# Business Object Databinding

It would depend on what you are binding to, for a text box you could use Bindingsoucre, have a look here it is a great example.... http://www.java2s.com/Tutorial/CSharp/0460__GUI-Windows-Forms/DataEntryWithBinding.htm

for stuff like a dataview you can bind by the datasource property,  look at my code example.

1:
2:
3:
4:
5:
DataView dv = DropDowns.GetDropDownItems(dropdownType, inspectionType, companyId);
            dropdown.DisplayMember = "DropdownItem_DisplayName";//display name (dataview column name)
            dropdown.ValueMember = "DropdownItem_Name";//value behind display name (dataview column name)
            dropdown.DataSource = dv;
            dv.Sort = "DropdownItem_DisplayName";
Random Solutions  
 
programming4us programming4us