Populated ListBox

  • 15 years ago

    Hello I'm trying to populate a ListBox using a DataSet in VB .MET
    I have 3 TextBoxes (ID, LastName and FirstName) and a ListBox
    Using the DataSet method I can fill the new table with Id, last name and first name...
    but the LidtBox still empty...!



    Try
                  objDataAdapter.SelectCommand = New OleDb.OleDbCommand(MySQL, objConn)
                   'Fill the table (Cartes)
                   objDataAdapter.Fill(objDataSet, "Cards")
                   'Close the connection to the DataBase
                   objConn.Close()


                   'Binding the TextBoxes with Data
                   TextBoxNom.DataBindings.Add("Text", objDataSet, "Cartes.EmpNom")
                   TextBoxPrenom.DataBindings.Add("Text", objDataSet, "Cartes.Emp
    Prénom")
                   ListBox.DataBindings.Add("Text", objDataSet, "Cartes.EmployésCartesNom")
          Catch
                               exceptionObject As Exception
                   MsgBox(exceptionObject.Message)
               End Try


    Thankyou

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.” - Alan Kay