Edit 1
I believe my problem stems from the following. The function that fills the dropdown portion sets the Display Member to the CountyName. Then when I try and set the SelectedText or EditValue, as has been suggested, that function only returns the CountyID which it try's to match to something in the DropDown list DisplayMember. I need it to match it to something in the ValueMember list.
Using the following I got it to work but it is a HACK and I'd greatly appreciate finding a real solution.
lkuResidenceCounty.ItemIndex = Convert.ToInt32(row["ResidencyCountyID"].ToString());
Original Post
I have a lookup box(DevExpress) on a member form that I fill the possible values in from the DB with this code -->
lkuResidenceCounty.Properties.DataSource = ConnectBLL.BLL.Person.CountyList();
lkuResidenceCounty.Properties.PopulateColumns();
lkuResidenceCounty.Properties.DisplayMember = "CountyName";
lkuResidenceCounty.Properties.ValueMember = "CountyID";
lkuResidenceCounty.Properties.Columns[0].Visible = false;
lkuResidenceCounty.Properties.Columns[2].Visible = false;
lkuResidenceCounty.Properties.Columns[3].Visible = false;
This works just fine as the CountyName is displayed as expected.
However, When I try and load an existing member's value for this field using the below, which is part of a function that takes a row from the DataSet -->
lkuResidenceCounty.Properties.ValueMember = row["ResidencyCountyID"].ToString();
I get a blank box. I have stepped through the code and the correct ID is being returned for the member.
Unfortunately the stored procedure to fill the dropdown options pulls from a Maintenance Table with the columns "CountyName" & "CountyID". So that is correct. Unfortunately, the stored procedure to load a specific person's current county pulls from the Person Table where there is a column called "ResidencyCountyID". It is so named because there is also a "ResponsibilityCountyID" column.
I need a way for them both to coexist, any solutions?
Thanks!