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. C#
  4. datagrid combobox column

datagrid combobox column

Scheduled Pinned Locked Moved C#
question
2 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.
  • U Offline
    U Offline
    User 589870
    wrote on last edited by
    #1

    hi i have added a combobox column to my datagrid and i want to populate it with integer list.how can i set data type of this column to hold integer values.

    G 1 Reply Last reply
    0
    • U User 589870

      hi i have added a combobox column to my datagrid and i want to populate it with integer list.how can i set data type of this column to hold integer values.

      G Offline
      G Offline
      Greg Chelstowski
      wrote on last edited by
      #2

      I understand you have set the DataSource of the DataGridViewComboBoxColumn, as well as its DisplayMember and ValueMember properties. When you have done so, just set the ValueType property of it, like so:

      ((DataGridViewComboBoxColumn)dataGridView1.Columns[2]).ValueType = typeof(Int32);

      Obviously, changing the name of dataGridView1 to your datagridview's name and the index (in this instance: 2) to the index of your combobox column. Hope it helps.

      var question = (_2b || !(_2b));

      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