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. .NET (Core and Framework)
  4. ComboBox.Items.Insert(int index, object obj) - > whats the object?

ComboBox.Items.Insert(int index, object obj) - > whats the object?

Scheduled Pinned Locked Moved .NET (Core and Framework)
questiondatabasevisual-studiowpfwcf
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.
  • S Offline
    S Offline
    saud_a_k
    wrote on last edited by
    #1

    Hi, Im using compact framework on VS 2005, Im binding a combobox alright, but I want to insert a new item at zero index, like on windows I used to: ComoBox1.Items.Insert(0,new ListItem("0","Select")); but there is no ListItem in compact framework. I am not able to insert that new item at an index, when I do a Combobox.Items.Insert(..... Vs gives me (int index,object obj). How do I insert that 0 index in compact framework??? please help.

    _____________________________________________________ Yea! I could be wrong...

    N 1 Reply Last reply
    0
    • S saud_a_k

      Hi, Im using compact framework on VS 2005, Im binding a combobox alright, but I want to insert a new item at zero index, like on windows I used to: ComoBox1.Items.Insert(0,new ListItem("0","Select")); but there is no ListItem in compact framework. I am not able to insert that new item at an index, when I do a Combobox.Items.Insert(..... Vs gives me (int index,object obj). How do I insert that 0 index in compact framework??? please help.

      _____________________________________________________ Yea! I could be wrong...

      N Offline
      N Offline
      Nagaraju_Focus
      wrote on last edited by
      #2

      Hi saud_a_k, Object means it may be any thing like string,int,char,class........ If u want insert an string at o index in combobox just use insert method: combobox1.Items.Insert(0,"Select") Use this it will works Nagaraju

      S 1 Reply Last reply
      0
      • N Nagaraju_Focus

        Hi saud_a_k, Object means it may be any thing like string,int,char,class........ If u want insert an string at o index in combobox just use insert method: combobox1.Items.Insert(0,"Select") Use this it will works Nagaraju

        S Offline
        S Offline
        saud_a_k
        wrote on last edited by
        #3

        DataSet ds = new DataSet();
        ds = getDataSet;
        if (ds.Tables[0].Rows.Count > 0)
        {
        c.ValueMember = "cpt_icd_mapping";
        c.DisplayMember = "icd_code";
        c.DataSource = ds.Tables[0].DefaultView;
        c.Items.Insert(0,"ICD"); // IT CAUSES ERROR HERE! value does not fall within //expected range
        }

        I did as I usually do in windows but it gave me the error: value does not fall within the expected range

        _____________________________________________________ Yea! I could be wrong...

        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