Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 22nd, 2007, 07:44 AM
Registered User
 
Join Date: Jun 2007
Location: Broek in Waterland, Noord-Holland, Netherlands.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot implicitly convert type ...

Hi fellow developers,

I have this error message: Cannot implicitly convert type 'Hotelplan.BO.Hotel' to 'Hotel'. The strange thing is that the code did build and did run until I tried to change the name of some other class (HotelplanManager to HotelplanRecManager). I'm trying to follow a design from Imar Spaanjaars (http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416).

And yes, it's the same hotel-class.

Because I couldn't figure out what was going on I did make a new solution and designed everything for the second time. At first it did build and run and after renaming a class I got the error message again.
In trying to solve it I did remove all of the temporary files at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files but no result!

Who can help me?

thanks Leon

Leon
Reply With Quote
  #2 (permalink)  
Old June 22nd, 2007, 08:35 AM
Registered User
 
Join Date: Jun 2007
Location: Broek in Waterland, Noord-Holland, Netherlands.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, After "View in Browser" (and some hour of searching for a solution, restarting the computer ,deleting temp-files and still having the problem) it seems to work again ????

But it still intrigues me, anyone?


Leon
Reply With Quote
  #3 (permalink)  
Old June 22nd, 2007, 10:47 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This seems like a fairly strange problem. Either the class is "Hotel" or it isn't. If it is, it should cast without a problem. What is the type of the variable you are trying to cast? Is would appear from your error message that it was an instance of 'Hotelplan.BO.Hotel'. Where is the type 'Hotel' defined? Is it possible that that name is also used in your web application? I've caught myself occasionally with a case like this: I have a "*.BO.Product" class, but I also have a "Product" class that is a web page class. So in the code where you try to cast type "object" to "Product" the compiler doesn't know you meant "*.BO.Product" instead of "MyWebApp.Product". The problem is the name ambiguity.

-Peter
Reply With Quote
  #4 (permalink)  
Old June 22nd, 2007, 11:20 PM
Registered User
 
Join Date: Jun 2007
Location: Broek in Waterland, Noord-Holland, Netherlands.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried a hint I got from a fellow developer and I fully qualified my hotel-instance. Succes! After reviewing the project I saw that you were very right Peter: I also have a page that is called: yes Hotel.aspx That must be it.

Thanks for your reaction Peter!

gr Leon

Leon
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert "String" type to "Control" type ? kishore_peddi C# 4 January 11th, 2006 01:21 PM
cant implicitly convert type int to bool muskaanbajaj BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 19th, 2005 04:57 PM
Cannot implicitly convert type int to bool muskaanbajaj General .NET 12 May 5th, 2005 03:57 AM
Can't convert type 'bool' to 'int' Gjerstad BOOK: ASP.NET Website Programming Problem-Design-Solution 2 July 9th, 2003 10:33 AM



All times are GMT -4. The time now is 09:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.