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. Windows Forms
  4. How to Insert row from Binded Combo Box

How to Insert row from Binded Combo Box

Scheduled Pinned Locked Moved Windows Forms
helptutorial
3 Posts 3 Posters 3 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.
  • P Offline
    P Offline
    P T R K
    wrote on last edited by
    #1

    Hi Friends, I am using the following methods to bind the windows.combobox control. In this screen how to insert a value to 0 position of the list. cboKeyword.DataSource = dsResult.Tables["tmpTable"]; cboKeyword.DisplayMember = "ProductKeyword"; cboKeyword.ValueMember = "PortalProductMasterID"; Keyword k = new Keyword(); k.KeywordID = ""; k.KeywordName = "<-Select Keyword->"; cboKeyword.Items.Insert(0, k); It is not working. Please Help Thanks in Advance Rameshkumar Thirumalaisamy

    P C 2 Replies Last reply
    0
    • P P T R K

      Hi Friends, I am using the following methods to bind the windows.combobox control. In this screen how to insert a value to 0 position of the list. cboKeyword.DataSource = dsResult.Tables["tmpTable"]; cboKeyword.DisplayMember = "ProductKeyword"; cboKeyword.ValueMember = "PortalProductMasterID"; Keyword k = new Keyword(); k.KeywordID = ""; k.KeywordName = "<-Select Keyword->"; cboKeyword.Items.Insert(0, k); It is not working. Please Help Thanks in Advance Rameshkumar Thirumalaisamy

      P Offline
      P Offline
      PandemoniumPasha
      wrote on last edited by
      #2

      hi, it seem that you are binding two different types to a single combobox. first you bind the "tmpTable" with the columns "ProductKeyword" and "PortalProductMasterID" then you bind an object "Keyword". but from the code you provided, i don't see any similarity between the two - "tmpTable" and "Keyword". your existing "Keyword" class doesn't contain the properties you are trying to bind. what you should do is make the class "Keyword" comparable to the table you are trying to bind, i.e. add the properties "ProductKeyword" and "PortalProductMasterID" to you existing class - "Keyword". hope this helps reagards :)

      1 Reply Last reply
      0
      • P P T R K

        Hi Friends, I am using the following methods to bind the windows.combobox control. In this screen how to insert a value to 0 position of the list. cboKeyword.DataSource = dsResult.Tables["tmpTable"]; cboKeyword.DisplayMember = "ProductKeyword"; cboKeyword.ValueMember = "PortalProductMasterID"; Keyword k = new Keyword(); k.KeywordID = ""; k.KeywordName = "<-Select Keyword->"; cboKeyword.Items.Insert(0, k); It is not working. Please Help Thanks in Advance Rameshkumar Thirumalaisamy

        C Offline
        C Offline
        Ch_Shahzad iqbal
        wrote on last edited by
        #3

        Please Check It cboKeyWord.Items.Add( new ListItem("<-Select KeyWord>-", "0"));

        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