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. bind data from database to datagridview combobox

bind data from database to datagridview combobox

Scheduled Pinned Locked Moved Visual Basic
databasetutorial
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.
  • K Offline
    K Offline
    KIDYA
    wrote on last edited by
    #1

    Hello Experts!! I am using following code to bind data from db to datagridview column having type combobox. but i dont know how to show data into combobox.

    Dim o As New designpant
    Dim i As Integer
    rssearch = New ADODB.Recordset
    rssearch.Open("select srno from designpant", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockPessimistic)
    While Not rssearch.EOF
    o = New designpant
    o.dsrno = rssearch.Fields("srno").Value

            Dim row1() As String = {o.dsrno}
            Dim rows() As Object = {row1}
            Dim rowArray As String()
            For Each rowArray In rows
                   Dim no As Integer = rowArray(0)
                'ComboBox1.Items.Add(no)
                dgvsherwanibottom.Columns  **//like combobox1 i want to show rowArray contents into gridview combobox  **            Next rowArray
    
    D 1 Reply Last reply
    0
    • K KIDYA

      Hello Experts!! I am using following code to bind data from db to datagridview column having type combobox. but i dont know how to show data into combobox.

      Dim o As New designpant
      Dim i As Integer
      rssearch = New ADODB.Recordset
      rssearch.Open("select srno from designpant", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockPessimistic)
      While Not rssearch.EOF
      o = New designpant
      o.dsrno = rssearch.Fields("srno").Value

              Dim row1() As String = {o.dsrno}
              Dim rows() As Object = {row1}
              Dim rowArray As String()
              For Each rowArray In rows
                     Dim no As Integer = rowArray(0)
                  'ComboBox1.Items.Add(no)
                  dgvsherwanibottom.Columns  **//like combobox1 i want to show rowArray contents into gridview combobox  **            Next rowArray
      
      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      1. DataGridViewComboBoxColumn 2. DataGridViewComboBoxColumn.DataSource 3. DataGridViewComboBoxColumn.DisplayMember 4. DataGridViewComboBoxColumn.ValueMember

      K 1 Reply Last reply
      0
      • D dan sh

        1. DataGridViewComboBoxColumn 2. DataGridViewComboBoxColumn.DataSource 3. DataGridViewComboBoxColumn.DisplayMember 4. DataGridViewComboBoxColumn.ValueMember

        K Offline
        K Offline
        KIDYA
        wrote on last edited by
        #3

        In my code it shows only DataGridViewComboBoxColumn.Equals and DataGridViewComboBoxColumn.reference properties Does i made any mistake? Where i have to write this?? i am trying it in form load.

        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