Results 1 to 4 of 4

Thread: Items? (Resolved)

  1. #1

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Resolved Items? (Resolved)

    Hello... Which would be the class I should use to match a ListBox and a ComboBox property of "Items"?

    I tried with System.Collections.ArrayList, but it appears not to work... Any suggestions?

    I have a Dictionary Class I created and I want to populate a ListBox and a ComboBox with its values or keys depending on the form I am on. How can I do this?

    Thanks in advance! (Why does it tell me the Items of a ListBox is read-only?)
    Last edited by Tec-Nico; Oct 3rd, 2004 at 02:03 PM.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  2. #2

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Ok, let me show you an example...

    Dictionary:
    Keys Values
    "1" "Room 1"
    "2" "Room 2"
    "3" "Room 3"

    And I want to have in a listBox
    listBox:
    Items
    "Room 1"
    "Room 2"
    "Room 3"

    And I want to have in a comboBox
    comboBox:
    Items
    "1"
    "2"
    "3"

    This is an example, don't think I wouldn't get the number instead of parsing it to a string.

    Now let us think that Room is a Class... And I want to populate the listBox with the Name of the room... How would I be able to do this? Thanks again... Please help this is due tomorrow and I haven't been able to think of a solution!


    Dictionary:
    Keys Values
    "1" aRoom1
    "2" aRoom2
    "3" aRoom3

    aRoom1.Name = "Room 1"
    aRoom2.Name = "Room 2"
    aRoom3.Name = "Room 3"

    listBox:
    Items
    "Room 1"
    "Room 2"
    "Room 3"
    Last edited by Tec-Nico; May 22nd, 2003 at 05:50 PM.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    just add the item itself to the listbox/combobox as .Add() method accepts a object type object
    \m/\m/

  4. #4

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Thanks PT Exorcist that is what I had to do at the End. I did not want to do that since I thought I could simply assign a Collection to the Collection of Items the controls had.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width