Implicit Conversion from Bitmap to Image?

T

The Confessor

The following code:

MapGraphics(ListBox_Graphics.SelectedIndex - 1).MapBitmap =
System.Drawing.Bitmap.FromFile(OpenFileDialog_SelectFile.FileName)

incurs the following error:

Option Strict On disallows implicit conversions from
'System.Drawing.Image' to 'System.Drawing.Bitmap'.

MapGraphics.MapBitmap is earlier declared as follows in a module:

Friend MapBitmap As System.Drawing.Bitmap = Nothing

And the parent class's array is instantiated as follows:

MapGraphics(0) = New MapGraphicsTemplate

What am I missing? Why is it trying to convert from Bitmap to Image? And if
necessary, is there a VB routine that I can use?

Much thanks for any replies,

The Confessor
 
M

Mattias Sjögren

What am I missing?

There's no Bitmap.FromFile method really. It's Image.FromFile (but
available as Bitmap.FromFile since Bitmap derives from Image) and it
returns an Image object.


Mattias
 

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