.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 27th, 2009, 05:05 AM
javaman javaman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 33 javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 27 m 59 sec
Reputation Power: 5
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.

Reply With Quote
  #2  
Old October 27th, 2009, 09:35 AM
Rictor's Avatar
Rictor Rictor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 326 Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 18 h 3 m 9 sec
Reputation Power: 213
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?

Reply With Quote
  #3  
Old October 29th, 2009, 12:29 PM
javaman javaman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 33 javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 27 m 59 sec
Reputation Power: 5
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!
Comments on this post
micky agrees: Thanx for sharing the solution

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > ASP.Net/VB.Net - Error about narrowing conversion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek