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. the value of comboBox like the dataGrid's key value

the value of comboBox like the dataGrid's key value

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdatabasesql-server
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.
  • C Offline
    C Offline
    costavo
    wrote on last edited by
    #1

    hello, How can I do a relation between a DataGrid and a ComboBox outside the DataGrid? I need a help in syntax, using vb.net 2003 and sql server 2000 thank you

    B 1 Reply Last reply
    0
    • C costavo

      hello, How can I do a relation between a DataGrid and a ComboBox outside the DataGrid? I need a help in syntax, using vb.net 2003 and sql server 2000 thank you

      B Offline
      B Offline
      bertvan
      wrote on last edited by
      #2

      Not a very clear question, but if you bind a bindingsource to your datagridview, you can use the alter the currently selected row by changing the .Current property of the bindingsource. I'm guessing you want to pick a row by selecting a value form your ComboBox, so you could do something like this:Dim dgv As New DataGridView() Dim bs As New BindingSource() dgv.DataSource = bs bs.DataSource = myDataSet Dim cb As New ComboBox()
      And then on SelectedIndexChange event of the combobox, you can set the bs.Current to the selected Value.

      C 1 Reply Last reply
      0
      • B bertvan

        Not a very clear question, but if you bind a bindingsource to your datagridview, you can use the alter the currently selected row by changing the .Current property of the bindingsource. I'm guessing you want to pick a row by selecting a value form your ComboBox, so you could do something like this:Dim dgv As New DataGridView() Dim bs As New BindingSource() dgv.DataSource = bs bs.DataSource = myDataSet Dim cb As New ComboBox()
        And then on SelectedIndexChange event of the combobox, you can set the bs.Current to the selected Value.

        C Offline
        C Offline
        costavo
        wrote on last edited by
        #3

        10x bertburtbort but the question is that what i really need , the combobox brings its data from database. when a selected value in the comboBox then its details displayed in the dataGrid actually the data in datagrid is brought from an other table in the database that is what i need 10x again

        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