Results 1 to 3 of 3

Thread: [RESOLVED] Populate unbound Combobox w. Valuemember

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2005
    Location
    Germany
    Posts
    49

    Resolved [RESOLVED] Populate unbound Combobox w. Valuemember

    Hi all, I've been away for a while from VB6 and just beginning with VB.NET 2008.

    What I'm just trying to do is the following:

    I need to fill a combobox from a dataset, but I have to translate the entries before displaying them. That's why I assume I have to use a loop to add the Items.

    Yet if I simply use "comboBox.Items.Add()" then I can't set something like a ValueMember to store the ID.

    Any ideas how to accomplish this?

  2. #2
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Populate unbound Combobox w. Valuemember

    Just do a loop and interact with all datarow's in the datatable that you want to change, after this just set the combo box datasource to the datatable, and set the value member and the display member...

    vb.net Code:
    1. For Each r As DataRow In DataTable1.rows
    2.  r("col1") = "NewValue"
    3.  r("col2") = "NewValue"
    4. Next

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2005
    Location
    Germany
    Posts
    49

    Re: Populate unbound Combobox w. Valuemember

    Thanks, mickey!

    How easy can it get? I got stuck into some complicated idea and did not think about that approach!

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width