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. Datagridview comboboxcolumn question

Datagridview comboboxcolumn question

Scheduled Pinned Locked Moved C#
3 Posts 3 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.
  • N Offline
    N Offline
    NewToAspDotNet
    wrote on last edited by
    #1

    Hi, I have a basice question. Im showing some data in datagridview control. One of the columns is of the type combobox. When populating this combobx with data, i want that the first item is selected. How can i do that? Thanks.

    A 1 Reply Last reply
    0
    • N NewToAspDotNet

      Hi, I have a basice question. Im showing some data in datagridview control. One of the columns is of the type combobox. When populating this combobx with data, i want that the first item is selected. How can i do that? Thanks.

      A Offline
      A Offline
      al3xutzu00
      wrote on last edited by
      #2

      Hi, After you have initialized the combo box with values try using this :

      [combo_box_name].SelectedItem = [value];

      . (without the brackets):) It works for me. Is this what you were asking? Regards, Alex

      X 1 Reply Last reply
      0
      • A al3xutzu00

        Hi, After you have initialized the combo box with values try using this :

        [combo_box_name].SelectedItem = [value];

        . (without the brackets):) It works for me. Is this what you were asking? Regards, Alex

        X Offline
        X Offline
        Xmen Real
        wrote on last edited by
        #3

        Combobox.SelectedIndex = 0; is more accurate. As well as check if Combobox have items. eg

        if(Combobox.Items.Count != 0)

        TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

        ----------------------------------------------- 128 bit encrypted signature, crack if you can

        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