473,395 Members | 1,639 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,395 software developers and data experts.

Problem with casting

Hi,

We have an very strange error and i though you can help us to
understand what is happening.

First we have an interface defined as:

---code-begins
Public Interface ILessonReadersDAO
<... properties and methods here ...>
End Interface
---code-ends

Then we have different objects who implement that interface, and some
classes who use that interfaces... particulary we have one method in
one class defined as:

---code-begins
Public Shared Function GenerateContentTemplate(ByVal lessionId As
Long, ByVal sectionId As Long, ByVal slideId As Long, ByVal access As
ILessonReadersDAO) As StringTemplate
---code-ends

Now... the problem is with this code:

---code-begins
Dim access As ILessonReadersDAO = new LessonReadersADO()

Dim sTemplate As StringTemplate =
LessonContentBuilder.GenerateContentTemplate(Lesso nId, SectionId,
SlideId, access)
---code-ends

This code compiles ok but from time to time we get the following
message:
Option Strict On disallows implicit conversions from
'Lesson.ILessonReadersDAO' to 'Lesson.ILessonReadersDAO'.

If we recompile it works, just happens from time to time.

The VS IDE give us a hint to change 'access' to CType(access,
ILessonReadersDAO), we changed it:

---code-begins
Dim sTemplate As StringTemplate =
LessonContentBuilder.GenerateContentTemplate(Lesso nId, SectionId,
SlideId, access)
---code-ends

and we still have the same problem.

I don't know if somebody has the same problem or knows what is
happening here.

We use .Net 2.0, VS 2005, the solution has C# and VB.Net projecs.

Regards,
Edgar Zavala.
Jul 14 '08 #1
2 917
Edgar Zavala wrote:
Option Strict On disallows implicit conversions from
'Lesson.ILessonReadersDAO' to 'Lesson.ILessonReadersDAO'.
This message suggests to me that sometimes you are making a change that requires
rebuilding the project. It is as if the compiler sees the pending new version of
ILessonReadersDAO as a different type from the last built version of
ILessonReadersDAO.

If rebuilding fixes it every time, I would not worry about it. It happens.
Jul 14 '08 #2
On Jul 13, 7:46*pm, "Steve Gerrard" <mynameh...@comcast.netwrote:
Edgar Zavala wrote:
Option Strict On disallows implicit conversions from
'Lesson.ILessonReadersDAO' to 'Lesson.ILessonReadersDAO'.

This message suggests to me that sometimes you are making a change that requires
rebuilding the project. It is as if the compiler sees the pending new version of
ILessonReadersDAO as a different type from the last built version of
ILessonReadersDAO.

If rebuilding fixes it every time, I would not worry about it. It happens..
Yes we can live with that, but is anoying and time consuming because
requires a Rebuild, also ... the porblem seems to be the casting
"Option Strict On disallows implicit conversions from
'Lesson.ILessonReadersDAO' to 'Lesson.ILessonReadersDAO'.", we think
this is the same class, there should be no implicit conversion.

Regards,
Edgar Zavala.
Jul 14 '08 #3

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

Similar topics

2
by: ghostdog | last post by:
hi, i got this opengl/c++ code: <code> void render(CMesh *mesh){ ... float *pVertices; int *pIndices;
17
by: Jon Slaughter | last post by:
I'm having a little trouble understanding what the slicing problem is. In B.S.'s C++ PL3rdEd he says "Becayse the Employee copy functions do not know anything about Managers, only the Employee...
10
by: Ben | last post by:
Hi, I am a newbie with C and am trying to get a simple linked list working for my program. The structure of each linked list stores the char *data and *next referencing to the next link. The...
14
by: Jason Sewall | last post by:
Hello, I'm using the intel C++ 8.0 compiler on windows and I'm working on some software that uses the following lines of code: gf->invdim = 1.0/(double)dim; printf("invdim: %f\n",...
6
by: Carlo Marchesoni | last post by:
I have an ASP.NET/C# solution, where I can perfectly cast something I stored in the session object to a class of mine (BackEnd), as this: ->be = (BackEnd)Session;<- But if I try to do the same:...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
11
by: Vinod | last post by:
Hi, I am working in the project where VC6 code is ported to VC8 (VC++ .Net 2005) I got a problem when I cast a double value to unsigned int. Problem is I couldn’t get the proper value after...
7
by: Ajeet | last post by:
hi I am having some difficulty in casting using generics. These are the classes. public interface IProvider<PROF> where PROF : IProviderProfile { //Some properties/methods }
4
by: Wally Barnes | last post by:
Can someone help a poor C++ programmer that learned the language before there was a standard lib .. etc ? Basically I have two classes that look something like below: template <class T>...
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.