473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Conversion from Object to System.Drawing.Image

I get the following error in my code when I set Option Strict to On:
Option Strict On disallows implicit conversions from 'System.Object'
to 'System.Drawing.Image'

The blue error underline starts at "ResMan" and goes to the end of the
line in this line of code:
Dim i As System.Drawing.Image = ResMan.GetObject("logo.gif")

ResMan is declared in another module as follows:
Public ResMan As New Resources.ResourceManager("DemoProject.Images",
System.Reflection.Assembly.GetCallingAssembly)
I can see that the GetObject method returns an Object and I need a
System.Drawing.Image, but how do I do the explicit conversion?
--
Thanks in advance,
Andy

Dec 2 '05 #1
2 2231
Hi,

Dim i As System.Drawing.Image = CType(ResMan.GetObject("logo.gif"),Image)

Ken
---------------------
<an*******@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I get the following error in my code when I set Option Strict to On:
Option Strict On disallows implicit conversions from 'System.Object'
to 'System.Drawing.Image'

The blue error underline starts at "ResMan" and goes to the end of the
line in this line of code:
Dim i As System.Drawing.Image = ResMan.GetObject("logo.gif")

ResMan is declared in another module as follows:
Public ResMan As New Resources.ResourceManager("DemoProject.Images",
System.Reflection.Assembly.GetCallingAssembly)
I can see that the GetObject method returns an Object and I need a
System.Drawing.Image, but how do I do the explicit conversion?
--
Thanks in advance,
Andy

Dec 3 '05 #2
I can't try that out yet (the project is in a virtual machine that just
got moved off of my laptop), but I'll assume it works and say thank-you
very much. I don't know how I missed such a simple solution.

Dec 6 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Duncan Welch | last post by:
I've got users uploading a file, which I then want resize, make a thumbnail out of, then delete. The image and thumbnail are working fine, but when I try to delete the image, I get an error: "The...
0
by: Deepak C.G via .NET 247 | last post by:
I want to dispose the image object in my child form, unless I won't dispose this object i can't delete the image file in my folder. I get this error in MDIparent form "An unhandled exception...
0
by: David R. | last post by:
I found a script that converts a regular size image to a thumbnail. It's a wonderful script, except the thumbnail quality is a bit low. I'd like to add the following code to improve the output...
0
by: David R. | last post by:
I found a script that converts a regular size image to a thumbnail. It's a wonderful script, except the thumbnail quality is a bit low. I'd like to add the following code to improve the output...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.