Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Handling Valuemember of Combox placed in a grid

Handling Valuemember of Combox placed in a grid

Scheduled Pinned Locked Moved Visual Basic
csshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    infotools
    wrote on last edited by
    #1

    With the help from Code Project site I have been successful in placeing various controls in grid. Now it has two three shortcomings (!) as of now. 1. If I use datatable as datasource to combobox placed in datagrid, assign "Name" and "Id" as Display and Value member respectively, In "SelectedValueChange" event it returns "Name" as Displaymember and "Id" as Valuemember instead of actual values. The combobox shows proper values of "Name". 2. I tried to assign values of datagrid cell to datatable row element as follows but it did not work... table.rows(1).Itemarray(1) = dgGrid(CurrentRowIndex,3) above line is indicative, actual code has proper names for table, grid, etc. also put in a loop to iterate. any solution to these issues are welcome.

    thanks, Madhav

    D 1 Reply Last reply
    0
    • I infotools

      With the help from Code Project site I have been successful in placeing various controls in grid. Now it has two three shortcomings (!) as of now. 1. If I use datatable as datasource to combobox placed in datagrid, assign "Name" and "Id" as Display and Value member respectively, In "SelectedValueChange" event it returns "Name" as Displaymember and "Id" as Valuemember instead of actual values. The combobox shows proper values of "Name". 2. I tried to assign values of datagrid cell to datatable row element as follows but it did not work... table.rows(1).Itemarray(1) = dgGrid(CurrentRowIndex,3) above line is indicative, actual code has proper names for table, grid, etc. also put in a loop to iterate. any solution to these issues are welcome.

      thanks, Madhav

      D Offline
      D Offline
      deathbat
      wrote on last edited by
      #2

      for problem one can you paste your code your should have somthing like ComboBox.DisplayMember = "table.colum" ComboBox.ValueMember = "table.colum2" Private Sub ComboBox_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox.SelectedValueChanged TextBox.Text = ComboBox2.SelectedValue End Sub this should give you whatever record is in colum2 when colum one is selected make sure you spell the table and colum values right or it WILL give you just the text a good trick is if you are setting programically get the values by setting in designer first then just copy and paste

      I 1 Reply Last reply
      0
      • D deathbat

        for problem one can you paste your code your should have somthing like ComboBox.DisplayMember = "table.colum" ComboBox.ValueMember = "table.colum2" Private Sub ComboBox_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox.SelectedValueChanged TextBox.Text = ComboBox2.SelectedValue End Sub this should give you whatever record is in colum2 when colum one is selected make sure you spell the table and colum values right or it WILL give you just the text a good trick is if you are setting programically get the values by setting in designer first then just copy and paste

        I Offline
        I Offline
        infotools
        wrote on last edited by
        #3

        Thanks a lot. We misssed on SelectedValue property. It's working fine now. :)

        thanks, Madhav

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups