neildt
neildt

Reputation: 5352

Why can't I access Child objects in my BindingSource in the Advanced Binding Dialog

I have the following classes;

public class Booking
{
    public int BookingId {get;set;}
    public bool Cancelled {get;set;}
    public BookingSummary BookingSummary {get;set;}
}

public class BookingSummary
{
   public string Comments {get;set;}
   public decimal TotalRate {get;set;}
}

In my windows application, I have added a BindingSource to my form, and I'm trying to map Booking.BookingSummary.TotalRate property to a text box. But as you can see in the dialog box below, the BookingSummary isn't expandable, so I can't pick the child property TotalRate.

enter image description here

Can anyone help and advise how I can overcome this problem ?

Upvotes: 1

Views: 645

Answers (1)

terrybozzio
terrybozzio

Reputation: 4542

supposing your textbox is named textbox1 and your bindingsource is bindingsource1:

textBox1.DataBindings.Add("Text", bindingSource1, "BookingSummary.TotalRate");

Upvotes: 3

Related Questions