Advertisement

07.03.2008 at 06:21AM PDT, ID: 23536692
[x]
Attachment Details

Adding values to the valuemember of a combobox

Asked by indy500fan in Microsoft Visual Basic.Net

Tags: VB.NET, VS2005

friends,

I am trying a new method of getting data (OSD's) and I am having trouble getting the valuemember added to the combobox that I am trying to populate.

Here is where I am tryting to populate it:

    Public Sub ProcessCarList(ByVal RunID As Integer)
        Try
            frmMain.cmbPickACar.Items.Clear()

            Using TableAdapter As New dsPenalizedCarTableAdapters.CarNumberListTableAdapter
                Using DataTable As dsPenalizedCar.CarNumbersDataTable = TableAdapter.GetData(RunID)
                    Dim Row As dsPenalizedCar.CarNumbersRow
                    For Each Row In DataTable
                        frmMain.cmbPickACar.Items.Add(Row.CarNumber)
                        frmMain.cmbPickACar.ValueMember = (Row.ResultID)
                    Next
                End Using
            End Using
        Catch ex As Exception

        End Try

    End Sub

Now, when I click the combobox, I see all the car numbers listed; however, if I try to use the value portion of the combobox, there is nothing in it.

    Private Sub cmbPickACar_DropDown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPickACar.DropDown
        Dim HandleCars As New HandleCarList
        HandleCars.ProcessCarList(RunID)
    End Sub

    Private Sub cmbPickACar_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPickACar.SelectedIndexChanged
        Dim ResultItemIDToUse As String = ""

        If cmbPickACar.SelectedIndex <> -1 Then
            ResultItemIDToUse = cmbPickACar.SelectedValue
            MessageBox.Show(ResultItemIDToUse)
        End If

    End Sub

What am I doing wrong?

Thanks in advance!

Best Regards,
EricStart Free Trial
[+][-]07.03.2008 at 07:11AM PDT, ID: 21925606

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 07:21AM PDT, ID: 21925698

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 07:27AM PDT, ID: 21925775

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 07:34AM PDT, ID: 21925851

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 07:56AM PDT, ID: 21926067

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: VB.NET, VS2005
Sign Up Now!
Solution Provided By: philipjonathan
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.03.2008 at 07:59AM PDT, ID: 21926095

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 09:14AM PDT, ID: 21926885

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 10:56PM PDT, ID: 21931212

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 12:22AM PDT, ID: 21931473

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628