Hashtable to windows form

  • Thread starter Thread starter Arjen
  • Start date Start date
A

Arjen

Hello,

I have a hash table... some results from it I like to see in a windows form.
Which component must I use?

Users may select one item in the "list" (from the hash table)...
How can I see which item the user haves selected?

Thanks!
Arjen
 
Arjen,

You can not bind directly to the hashtable. The reason for this is that
it does not implement IList. What you want to do is either copy the values
from the hashtable (both the key and the value) to a data table, using one
column for the key, and one for the value.

Or, if you want, you can return just the keys and the values as an array
(I believe) and then bind to those lists.

Hope this helps.
 
Hi,

Thanks.

I have a hashtable which I converted to a datatable with "key" and "value"
as column names.
Now I want to fill the datagrid with the datatable, but I only want to see
the
"value" column.
The user may select (double click) one recod inside this datagrid, I want to
know the value inside the "Key" column of the selected column. Remember, the
column "Key" you cannot see on the screen.

Can you/somebody show me how to connect the datatable to the datagrid?
And how to hide the "Key" column?

(With a sample or with a good URL)

Thanks!
Arjen





Nicholas Paldino said:
Arjen,

You can not bind directly to the hashtable. The reason for this is that
it does not implement IList. What you want to do is either copy the values
from the hashtable (both the key and the value) to a data table, using one
column for the key, and one for the value.

Or, if you want, you can return just the keys and the values as an array
(I believe) and then bind to those lists.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Arjen said:
Hello,

I have a hash table... some results from it I like to see in a windows form.
Which component must I use?

Users may select one item in the "list" (from the hash table)...
How can I see which item the user haves selected?

Thanks!
Arjen
 
Got it... set column with to 0.

Arjen said:
Hi,

Thanks.

I have a hashtable which I converted to a datatable with "key" and "value"
as column names.
Now I want to fill the datagrid with the datatable, but I only want to see
the
"value" column.
The user may select (double click) one recod inside this datagrid, I want to
know the value inside the "Key" column of the selected column. Remember, the
column "Key" you cannot see on the screen.

Can you/somebody show me how to connect the datatable to the datagrid?
And how to hide the "Key" column?

(With a sample or with a good URL)

Thanks!
Arjen





Nicholas Paldino said:
Arjen,

You can not bind directly to the hashtable. The reason for this is that
it does not implement IList. What you want to do is either copy the values
from the hashtable (both the key and the value) to a data table, using one
column for the key, and one for the value.

Or, if you want, you can return just the keys and the values as an array
(I believe) and then bind to those lists.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Arjen said:
Hello,

I have a hash table... some results from it I like to see in a windows form.
Which component must I use?

Users may select one item in the "list" (from the hash table)...
How can I see which item the user haves selected?

Thanks!
Arjen
 
Back
Top