Home All Groups Group Topic Archive Search About

Implicit Conversion from Bitmap to Image?

Author
17 Feb 2006 3:53 AM
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

Author
17 Feb 2006 6:32 AM
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

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.