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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. load combobox values into datagrid combobox

load combobox values into datagrid combobox

Scheduled Pinned Locked Moved C#
jsontutorialquestion
2 Posts 1 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.
  • R Offline
    R Offline
    Ronni Marker
    wrote on last edited by
    #1

    Hi all, I have a datagrid with 4 columns, 1st column is a combobox named "clmOptionNames" where i need to load the values from an combobox named "toolStripComboBox1" who is located outside the datagridview, the rest of the datagrid have values from a webservice and is loaded through the datasource. Is there anyone who know how to get the content from one combobox and then insert it into a datagridview combobox? the combobox is located at column 0 in the datagridview.

    R 1 Reply Last reply
    0
    • R Ronni Marker

      Hi all, I have a datagrid with 4 columns, 1st column is a combobox named "clmOptionNames" where i need to load the values from an combobox named "toolStripComboBox1" who is located outside the datagridview, the rest of the datagrid have values from a webservice and is loaded through the datasource. Is there anyone who know how to get the content from one combobox and then insert it into a datagridview combobox? the combobox is located at column 0 in the datagridview.

      R Offline
      R Offline
      Ronni Marker
      wrote on last edited by
      #2

      ah forgot to drop in my code....

              frm\_Rights frmRights = new frm\_Rights();
              if (toolStripComboBox1.Text.ToString().Length != 0)
              {
                  frmRights.label1.Text = toolStripComboBox1.Text.ToString();
                  frmRights.dataGridView1.Columns\[1\].HeaderText = "User Name";
                  //
                  frmRights.dataGridView1.Rows.Add("", "user1", "16-08-1971", "16:00:00");
                  frmRights.dataGridView1.Rows.Add("", "user2", "24-08-1983", "12:00:00");
                  BindingSource bindCombo = new BindingSource();
                  bindCombo.DataSource = toolStripComboBox1.Items;
      
                  DataGridViewComboBoxColumn datagridCombo = new DataGridViewComboBoxColumn();
                  datagridCombo.HeaderText = "Hello";
                  datagridCombo.DataSource = bindCombo;
                  frmRights.dataGridView1.Columns.Add(datagridCombo);
      
                  frmRights.ShowDialog(this);
      
              }
      

      The above code works well fine enough - only with the exception that it dont load the content into column 0 but just add a new column onto the datagridview.

      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