Databing with combo box and default value

Posts   
 
    
Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 03-Oct-2007 03:39:52   

i have 2 tables

tblcall linked to tblcustomer 1:1

i fetch the tblcall entity ( with prefetch to get the related customer)..this works fine.

i also fetch the customers which binds to the combo box fine..but the default customer is not being selected? How do i get it to select the correct customer?

I have tried the following

    cmboCustomers.DataBindings.Add("SelectedValue", oCall, "TblCustomer")
    Me.cmboCustomers.DataSource = _customers
    Me.cmboCustomers.DisplayMember = "Name"
    Me.cmboCustomers.ValueMember = "CustomerId"
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Oct-2007 11:16:30   

Is this a win app or a web app? Anyway I think you can set the selectedValue after databinding, on DataBound event?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 04-Oct-2007 14:43:35   

first bind, then select value.

Frans Bouma | Lead developer LLBLGen Pro