Getting error assigning a DataTable to a ComboBox DataSource?

I'm trying to bind a DataTable to a ComboBox and I'm getting the error below (see screenshot). Also, I posted my code below but I remember once that I was unable to programmatically assign a DataMember/ValueMember to a ComboBox. Maybe I was doing something wrong. Here is my code below.

        Private Sub GetMerchants(ByVal iAcctID As Integer)
        Dim dt As New DataTable

            dt = BL.GetMerchants(iAcctID)
            cmbMerchants.DataSource = Nothing
            cmbMerchants.DataSource = dt(0)
            cmbMerchants.DisplayMember = "name"
            cmbMerchants.ValueMember = "merchantID"
            cmbMerchants.SelectedIndex = -1

        Catch ex As Exception
            gstrErr = "frmTransactions/GetMerchants() - " & ex.Message
            MessageBox.Show(gstrErr, "User Notification", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dt(0) is a single row of a DataTable. You need to assign the entire DataTable to be the DataSource:

cmbMerchants.DataSource = dt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I don't want to sound ungrateful, but why did you think my response deserved only a B grade? How was it less than what you needed? It's customary, when you think there's a shortcoming in an answer, to explain what the problem is. This can be an opportunity for me to learn as well as you. Thanks.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

BlakeMcKennaAuthor Commented:

To be honest I'm not quite sure how this point system/grade thing works with EE. I normally give an "Excellent" when someone provides a solution that works. As for your answer of

    cmbMerchants.DataSource = dt

I have already tried this and still get the same results. I'm getting the error when I try to assign the DataMember/ValueMember properties...assigning the DataSource wasn't the issue.
So are you saying that the problem isn't solved? Then why did you close the question?

The DataTable is getting loaded, and gets its structure, from BL.GetMerchants(iAcctID). Have you checked to make sure the column names "name" and "merchantID" are in the table? What's the exact error you get, and what line is active when you get it?
BlakeMcKennaAuthor Commented:
I actually figured it out after you had made your last post...which is why I closed it. This is an application that I am working on for myself and it's on my machine at home so I can't recall what the fix was. My apologies for any confusion.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.