|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ASP.Net/VB.Net - Error about narrowing conversion
I am trying to create a webpage that I can upload an image an receive a resized jpeg. One of the variables are the quality. When I write the quality into the code, all is fine. When I try to get it through the Request.Form I get this weird error:
Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: This is the pertanent code: Code:
Dim quality = cInt(Request.Form("Quality"))
Dim encs As new EncoderParameters(1)
Dim enc As new EncoderParameter(Imaging.Encoder.Quality, quality)
encs.Param(0) = enc
The error is on the fourth line. By the way, I also set strict to off. |
|
#2
|
||||
|
||||
|
Have you done a Response.Write(Request.Form("Quality")) just to verify the value that is being passed is as expected? No spaces, that it's not null for whatever reason, etc?
|
|
#3
|
|||
|
|||
|
Thank you, Rictor, for trying to help.
Issue was resolved, however: After reading up and finding out that this kind of error occures from data type clashes, I rechecked my code and realized that I hadn't set the type As Integer. I added it and it works! |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > ASP.Net/VB.Net - Error about narrowing conversion |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|