Question

I have 2 Lookup edits in my winform. If I select 1st Lookup edit, need to add data source to 2nd Lookup edit based on what i selected in value in 1st Lookup edit. This all function can be done at run time.

This code i use currently for 1st Lookup edit and If i select any Item from 1st Lookup edit I need to fill / attach data source to 2nd Lookup edit.

How to complete my task ?

private void lookupedit1_EditValueChanged(object sender, EventArgs e)
    {

        object row = lookupedit1.Properties.GetDataSourceRowByKeyValue(lookupedit1.EditValue) as object;

        memoedit1.Text = (row as DataRowView)["BFlatNo"].ToString() + ", " + (row as DataRowView)["BLocation"].ToString() + ".";
        memoedit2.Text = (row as DataRowView)["DFlatNo"].ToString() + ", " + (row as DataRowView)["DLocation"].ToString() + ".";

    }

Thanks in advance.

Was it helpful?

Solution

You can do this as follows:

yourLookUpEdit.Properties.DataSource = //Your List or DataTable
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top