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

Casting to Interface at design time.

Hi all,

I am trying to cast my page to an Interface at design time with no joy.

sControl = ((IStatusPage)Page).[Interface code]

Despite this page 100% being inheriting this interface it will not
work.
I really do not want to cast to a class.

Any hints on where I am going wrong here?

Jul 28 '06 #1
2 968
Just as a hint .. if it doesn't work as stated, try rewriting it?

IStatusPage iPage = Page as IStatusPage;
if (iPage != null)
iPage.[interface code]

If nothing else, atleast you should be able to see if the "Page as
IStatusPage" is causing the problem, if so the class isn't interited from
IStatusPage after all.

/Micke

"Paul" <pa*********@corpoflondon.gov.ukwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi all,

I am trying to cast my page to an Interface at design time with no joy.

sControl = ((IStatusPage)Page).[Interface code]

Despite this page 100% being inheriting this interface it will not
work.
I really do not want to cast to a class.

Any hints on where I am going wrong here?

Aug 1 '06 #2
Sorry,

The code is just fine at runtime.

It is only in Design mode the problem exists.
It seems that the Visual Studio IDE does not bother
to process inheritance.

I should has mentioned that I am using an

if( Page is IStatusPage)

before the line I pasted.

So while your code will work it doesn't solve the actual problem.

Thanks for taking the time to reply though.

Paul

Micke Andersson wrote:
Just as a hint .. if it doesn't work as stated, try rewriting it?

IStatusPage iPage = Page as IStatusPage;
if (iPage != null)
iPage.[interface code]

If nothing else, atleast you should be able to see if the "Page as
IStatusPage" is causing the problem, if so the class isn't interited from
IStatusPage after all.

/Micke

"Paul" <pa*********@corpoflondon.gov.ukwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi all,

I am trying to cast my page to an Interface at design time with no joy.

sControl = ((IStatusPage)Page).[Interface code]

Despite this page 100% being inheriting this interface it will not
work.
I really do not want to cast to a class.

Any hints on where I am going wrong here?
Aug 3 '06 #3

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

Similar topics

3
by: ken | last post by:
I am getting this error from a gcc compile and I was wondering whether this was 100% valid. This seems a little extreme to me the c++ cast operators appear to only work on objects which defeats...
2
by: Zac | last post by:
Alright anyone who has 2c throw it in... I am working through a custom xml serializer and have come upon a conundrum, given our class design. The interface implemented on the base class (base...
2
by: Martin Hart - Memory Soft, S.L. | last post by:
Hi all: I still very new to the .NET world and don't know if what I am asking is due to an over-imaginative imagination or the fact that I have read too many fiction books!! Let me show you a...
7
by: yufufi | last post by:
lets say we have a 'shape' class which doesn't implement IComparable interface.. compiler doesn't give you error for the lines below.. shape b= new shape(); IComparable h; h=(IComparable)b;...
6
by: Philipp Schumann | last post by:
Hi, I have a need for "dynamic type casting": in other words, in a "MyConvert" method I get passed an Object "value" and a Type "type" and the method should attempt to convert value into type. ...
18
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have created an enum list like this: enum myEnum : int { This = 2, That, NewVal = 10, LastItm
1
by: pitdog | last post by:
This may not be the group to post this in. However I will try... I am interested in how the .NET runtime actually handles casting. For instance... This will work if you assume ChildProduct is...
3
by: Tigger | last post by:
I have an object which could be compared to a DataTable/List which I am trying to genericify. I've spent about a day so far in refactoring and in the process gone through some hoops and hit some...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.