Results 1 to 2 of 2

Thread: Getting value from Combobox

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Stockholm, Sweden
    Posts
    44
    Im using the followin commands to fill a combobox from a dataset:

    cmbProject.DataSource = myds.Tables(0)
    cmbProject.DisplayMember = "ProjectName"
    cmbProject.ValueMember = "ProjectId"

    That is working just fine. The problem is when I try to get a value from the combobox using:

    cmbProject.SelectedItem.ToString

    Then I get the value : "System.Data.DatarowView" when I actually want the value thats in the combobox.

    What am I doing wrong.

    TIA
    /John
    ********************
    VB 6
    VB 7 (.NET)
    DarkBasic (Beginner)
    ********************

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I just tested it, but your code works fine with me. At least when there is something selected.
    You could try cmbProject.Text

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