Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    combobox (VB.NET 2005)

    Second day getting to know vb .net. Not a good experience. Can someone tell me what are the steps that i need to take to bind listbox to a lookup table. I have created a form which is based on tblABC. A textbox on the form is based on another lookup table. The form displays contents of fields correctly however, the dropdown part of the combo is empty. What do I need to do to make sure that the combobox display the correct field content and also retrieve the items from the lookup table when my users press the down arrow on the combobox.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox (VB.NET 2005)

    Can you provide some details as to your data access setup? When you mention the lookup table, is this in a database or is it a DataTable object (part of a DataSet)?

  3. #3
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox (VB.NET 2005)

    umm..i am not sure. but i have a dataset which based on a table on the sql server. the lookup table is also on the server.

  4. #4
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox (VB.NET 2005)

    Tried this and tried that. It finally works. Have to make sure the bindingsource fot the lookup table is included, set the datasource, binding source...bla.bla.bla. But it works

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox (VB.NET 2005)

    I haven't spent the time to get up to speed with .NET 2.0 (2005) yet. But the way I would do this in 1.1 (2003) would be to populate the dataset (usually using a Data Adapter to get the data from the data source), set the Data Source of the drop-down to the desired table in the dataset (usually DataSet.Tables[0]) then bind the drop-down (DropDown.DataBind()).

    Hope this helps!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •