Converting a type "void" to a type "System.Drawing.Image"

I'm trying to input a thumbnail image in to a a image control.  I keep getting the same error "Cannot implicitly convert type void to type System.Drawing.Image".  I'm coding in C# I've been looking throught object browser to try to find a way to convert the type but it is not working.

can anyone help  

0
JWTech
2/25/2006 4:39:34 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

3 Replies
665 Views

Similar Articles

[PageSpeed] 45

Hi,

could it be that method has incorrect return type? is it your own method raising it? Post some code.


Thanks,

Teemu Keiski
Finland, EU
0
joteke
2/25/2006 9:39:31 AM

Here is the code: 

The error is commented. 

public static bool ThumbNailCallBack()

{

return false;

}

public static System.Drawing.Image GetImageSize(string Pic)

{

const string Image_Directory = "images1/";

string ImageUrl = Pic;

int imageheight = 100;

int imageWidth = 100;

ImageUrl = Image_Directory + ImageUrl;

Image fullImage = Image.FromFile(HttpContext.Current.Server.MapPath(ImageUrl));

HttpContext.Current.Response.ContentType = "image/jpeg";

Image.GetThumbnailImageAbort DummyCallBack = new Image.GetThumbnailImageAbort(ThumbNailCallBack);

//My error comes in here

Image thumbnailimage = fullImage.GetThumbnailImage(imageWidth, imageheight, DummyCallBack, IntPtr.Zero);

return thumbnailimage.Save(HttpContext.Current.Response.OutputStream, ImageFormat.Jpeg);

thumbnailimage.Dispose();

fullImage.Dispose();

}

0
JWTech
2/25/2006 5:01:15 PM

It's because thumbnailimage.Save(HttpContext.Current.Response.OutputStream, ImageFormat.Jpeg);

Doesn't return anything, e.g it doesn't return any instance as the method returns void (means it's a method with no return value) therefore you cannot have 'return' in the place it's now (and then GetImageSize method itsef wouldn't return anything so it couldn't have Image as return type)


Thanks,

Teemu Keiski
Finland, EU
0
joteke
2/26/2006 6:39:19 AM
Reply:

Similar Artilces:

Whan can i do? make "string" data type convert to "window" data type, and use a "window" name to get it ancestor "window name", thanks! i use pb5
Rich, With a string window name, you can open a window of that type if you need to. You could, of course, query that window object for any attributes. Another option is to use the LibraryExport function to export the definition of the window which is specified by the string. You can then parse the resulting file to get information on the ancestor object. HTH Sanjiv. "Rich" <windows_ce@netease.com> wrote in message news:2Xsr1WW0AHA.178@forums.sybase.com... > > > ...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

Get "Mail"/"Get "News" / "Write"/"Post" buttons?
If the "Get Mail" button text changed to "Get News", and "Write" changed to "Post" when TB's in the news-reading mode, it would save me and probably others from constantly forgetting to make the change before proceeding. :-) Or is there an extension to do this which I don't know about? Thanks! Bob Bob P wrote: > If the "Get Mail" button text changed to "Get News", and "Write" > changed to "Post" when TB's in the news-reading mode, it would save me > and probably others...

"Time Server Type" vs. "Timesync Type"
We have two time sources within our network: a Reference server and a Primary server . . . both are pointing to External Time Source servers and to each other. I was looking at their settings and confess I'm confused about the difference between two settings: - Default Time Server Type - Timesync Type Both settings offer the standard selection of Single, Secondary, Primary, and Reference. I've matched both settings to their server (either Primary or Reference) but I don't know what the difference represents. Could someone confirm how these settings should b...

quotes, quotes, quotes...
I am getting this error and I know what is causing it, but I have no idea how to fix it, any help would be great. The script steps through the /var/log/messages file on a linux server and puts The entries into a mysql database. However when it gets to the 'hlt' line in the messages file it just barfs. The single quotes are freaking it out. I know about quotes but not how to use in this situation. Thanks, Paul Error: May 27 17:53:00 localhost kernel: Checking 'hlt' instruction... OK. <----- doesn't like this in the messages file DBD::mysql::st exec...

How to get back to "fsRegular" type font from "fsBold"
I have looked in the Delphi XE help file and it states that "Regular" is a font style. However, after several lines of print code using fsBold, placing a Printer.Canvas.Font.Style := [fsBold] generates an error message when using Arial font. What am I doing incorrectly? How does one return to the "regular" font style? Thank you in advance for any information. John Shyer John Shyer wrote: > Printer.Canvas.Font.Style := [fsBold] generates an error message when using Arial font. What am I doing incorrectly? What's the error message? > How does on...

Convert "BCC" to "To:"
I'm guessing the answer to this is no, but I thought I'd ask. Is there any way to set GWIA to convert a "BCC:" recipient to a "To:" recipient? (Each person would be it's own To: Address) The problem we are having is that we use BCC because we don't want people to see other customers email addresses. We have found that some Spam software is tagging the e-mail as spam because the customers name is not in the "To:" field. Your thoughts or comments would be appreciated. --Matt No there isn't. Nor should there be because the recipien...

Proposal: "is defined" trait, "is typed" trait, "traits" pragma.
--Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline So I'm starting to write the inferencer. Immediately I encounter the problem that every type can potentially contain "undef": my IO $x = open('/etc/passwd'); $x = undef; $x.close; This raises the runtime error: *** Can't call method "close" on an undefined value. The "undef" literal can defeat the type checker freely: my Int @x := undef; say @x.end; # boom, undefined list generator, per S04 I understand $Larr...

What is this for? "<label style=""display:none;"" for=""" & cboFieldType.ClientID.ToString & """>Type</label>"
I'm digging through the code of DNN and I found many ocurrences of this type of code: lblFieldType.Text = "<label style=""display:none;"" for=""" & cboFieldType.ClientID.ToString & """>Type</label>" What is that code for? The label is never displayed and I could not figure out what DDN uses it for. thank you This is for ADA compliance. The guidelines require that form elements have an associated label. This helps the text readers out with identifying the different parts of the form. BruceDynamic...

while saving the file "Save as Type" in SaveDialogBox shows "MicrosoftExcelSheet" and "AllFiles", how can i restrict "AllFiles" and show only "MicrosoftExcelSheet" ..
Below is code written for opening XLFile.  HttpContext.Current.Response.Clear();HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + astr_FileName); HttpContext.Current.Response.AddHeader("Content-Length", abyte_Data.Length.ToString()); HttpContext.Current.Response.ContentType = astr_ContentType; //octet-stream"; or //"application/vnd.ms-excel"; HttpContext.Current.Response.BinaryWrite(abyte_Data);    Udaya.M...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

"Me" is better than "You"
Yes I know, strings are frozen. But let me talk about it, I really can't get through the idea of a PC talkin to me. I consider my PC as an extension of myself, not a dumb companion who addresses Me as You. Yes there are times when I get angry with Him while I work and get wrong calculations etc.., but it really is my fault, Me using wrong istructions and eventually wanting to find someone else to blame, but it's Me. And yes, I consider Thunderbird my mail program, reading my mail on my PC as Me. So I personally like to have Me in the header bar as a compact address ...

Integration of "Find" or "Find as you type"?
I have a XUL application with multiple browser elements (only one at a time is visible). How can I integrate "Find as you type" or the normal "Find" functionality inside my application (using Firefox 1.5). Andreas On Tue, 07 Feb 2006 12:19:53 +0100, Andreas Jung wrote: > I have a XUL application with multiple browser elements (only one at a > time is visible). How can I integrate "Find as you type" or the normal > "Find" functionality inside my application (using Firefox 1.5). Normally, I'd open up the jar file to see how ...

Web resources about - Converting a type "void" to a type "System.Drawing.Image" - asp.net.getting-started

Resources last updated: 12/25/2015 1:01:27 AM