|
-
May 22nd, 2003, 01:04 AM
#1
Thread Starter
Frenzied Member
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
-
May 22nd, 2003, 02:48 PM
#2
Thread Starter
Frenzied Member
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
-
May 23rd, 2003, 03:03 AM
#3
yay gay
just add the item itself to the listbox/combobox as .Add() method accepts a object type object
\m/  \m/
-
May 28th, 2003, 01:05 AM
#4
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|