Datamember property 'tblComboBoxLkUp' cannot be found on the datasource

Posted on 2006-06-08
Last Modified: 2008-02-01
I have one combobox and one datagrid.  The combobox has the pk that connects to the datagrid.  
I would like to pick a combobox and show the details  of the selection in the datagrid.

I get error "Datamember property 'tblComboBoxLkUp' cannot be found on the datasource during the following statement:
CbMtd.DataSource = BindSrceMtd;
CbMtd.DisplayMember = "tblComboLkUp.Name_Lk";

I've checked spelling, case and I still can't figure out what is wrong with this!!  Please HELP!!!!

This is the rest of the code that I have:

 Ds = new DataSet();
 Cmd = new SqlCommand(SProcLkUp, CohortConn);
                Cmd.CommandType = CommandType.StoredProcedure;
 Da = new SqlDataAdapter(Cmd);
 Da.Fill(Ds, "tblComboLkUp");

//the above gets the information from the look up table that will be stored in the combobox

 Cmd 2= new SqlCommand(SProcDetails, CohortConn);
                Cmd2.CommandType = CommandType.StoredProcedure;
 Da2 = new SqlDataAdapter(Cmd)2;
 Da2.Fill(Ds2, "tblDetails");

//the above is the dataset that contains details.

 DataRela = new DataRelation(MtdDetails, Ds.Tables["tblComboLkUp"].Columns["ColNm1"], Ds.Tables["tblDetails"].Columns["ColNm2"], false);

//data relation between combo and detail

 BindSrceMtd.DataSource = Ds;
 BindSrceMtd.DataMember = "tblComboLkUp";

BindSrceMtdDetail.DataSource = BindSrceMtd;
BindSrceMtdDetail.DataMember = "MtdDetails";//binded to relationship

DgvMtdDesc.DataSource = BindSrceMtdDetail;//datagrid bound to detail

CbMtd.DataSource = BindSrceMtd;
CbMtd.DisplayMember = "tblComboLkUp.Name_Lk";
CbMtd.ValueMember = "tblComboLkUp.ID_Lk";

Question by:yanci1179

    Author Comment

    Anybody?  Pleasssseeee
    LVL 12

    Accepted Solution

    CbMtd.DisplayMember = "Name_Lk";

    Author Comment

    such a small mistake has driven be crazy for the past 2 days!!!!  

    thanks you SO MUCH for you help!!!!

    Author Comment

    just curious, why does it not take "tblComboLkUp.Name_Lk"?
    LVL 12

    Expert Comment

    Table name (tblComboLkUp) is specified in DataMember property of the binding source. In DisplayMember property you specify a field from the datasource from where the values displayed in combobox are taken. You don't need to mention the TableName again.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now