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. Visual Basic
  4. Promblem with dynamically creating comboboxes in VS.NET 2K3

Promblem with dynamically creating comboboxes in VS.NET 2K3

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasevisual-studiowpfwcf
1 Posts 1 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.
  • D Offline
    D Offline
    David San Filippo
    wrote on last edited by
    #1

    Hi, I am looping through a database and creating dropdown lists dynamically using the combobox control and binding it to an arraylist with valid values. However I must be doing something wrong because when I run the code, all the comboboxes are linked together, in other words if I change the value of one of the comboboxes, all of them are changed. Here is some sample code: ------------------------------------------------ Dim fieldlabel As Windows.Forms.Label Dim filefields As Windows.Forms.ComboBox While myreader.Read If myreader("FLD_0") <> "/" Then Panel1.Controls.Add(New Windows.Forms.Label) fieldlabel = Panel1.Controls(controlindex) fieldlabel.Text = counter & ") " & X3Reader("FLD_0") fieldlabel.Location = New Point(1, ycord) fieldlabel.Size = New Size(100, 20) fieldlabel.Name = "label" & counter controlindex += 1 Panel1.Controls.Add(New Windows.Forms.ComboBox) filefields = Panel1.Controls(controlindex) temparrlist = New ArrayList temparrlist = filefieldsarrlist filefields.DataSource = temparrlist filefields.DropDownStyle = ComboBoxStyle.DropDownList filefields.Size = New Size(100, 20) filefields.Location = New Point(105, ycord) filefields.Name = "map" & counter controlindex += 1 ycord += 30 counter += 1 controlindex += 1 End If End While ------------------------------- Any ideas?

    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