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. Populating a combobox with a listview

Populating a combobox with a listview

Scheduled Pinned Locked Moved C#
tutorial
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.
  • M Offline
    M Offline
    mikeyb25
    wrote on last edited by
    #1

    Is there a way to populate a combobox wiht data in a listview. And use the combobox in different forms. For example the listview on form1 contains fist name column, last name column, and account number column. On Form2 I have 3 textboxes (firstName, LastName, accountNumber)a combobox that I want to contain data from the listview on form1. When the user selects an item in the combobox I want it to fill the textboxes with the appropriate data. :confused:

    J 1 Reply Last reply
    0
    • M mikeyb25

      Is there a way to populate a combobox wiht data in a listview. And use the combobox in different forms. For example the listview on form1 contains fist name column, last name column, and account number column. On Form2 I have 3 textboxes (firstName, LastName, accountNumber)a combobox that I want to contain data from the listview on form1. When the user selects an item in the combobox I want it to fill the textboxes with the appropriate data. :confused:

      J Offline
      J Offline
      JockerSoft
      wrote on last edited by
      #2

      to make the comboBox contain the same data of the listview(limited to 1 column only) you can set the DataSource property of the comboBox to listView1.Items and the DisplayMember property to Text . in the SelectedIndexChanged event of listView1 object , edit the Text property of the 2 textBoxes: private void listView1_SelectedIndexChanged(object sender, System.EventArgs e) { textBox1.Text=listView.SelectedItems[0].Text; textBox2.Text=listView.SelectedItems[0.SubItems[0].Text; }

      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