Can hashtable hold a picture image?

N

Noozer

Code sample:
dim hash as Hashtable 'Declare Hashtable
....
hash.add (picOne.image, "picture") 'Error here


picOne is a picturebox added to the form at design time with a GIF image
applied.

When the add method executes I get the following error:

An unhandled exception of type 'System.NullReferenceException' occurred in
HashTable test.exe

Additional information: Object reference not set to an instance of an
object.

Can a hashtable be used to hold picture images?

Thanks!
 
H

Herfried K. Wagner [MVP]

* "Noozer said:
dim hash as Hashtable 'Declare Hashtable

Replace the line above with 'Dim hash As New Hashtable()'.
Additional information: Object reference not set to an instance of an
object.

Can a hashtable be used to hold picture images?

Yes, it can hold references to images.
 
N

Noozer

Herfried K. Wagner said:
Replace the line above with 'Dim hash As New Hashtable()'.


Yes, it can hold references to images.

Thanks... I should use the "intelli" part of "intellisense" a bit more... I
had the object and the key swapped in my code. Ooops.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top