By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,692 Members | 1,218 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,692 IT Pros & Developers. It's quick & easy.

Implicit Conversion from Bitmap to Image?

P: n/a
The following code:

MapGraphics(ListBox_Graphics.SelectedIndex - 1).MapBitmap =
System.Drawing.Bitmap.FromFile(OpenFileDialog_Sele ctFile.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
Feb 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.
Feb 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.