473,403 Members | 2,293 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,403 software developers and data experts.

Cannot run VS 2003 project using MSHTML, with .Net 2.0


Our application was build with VS 2003.
I have tried to run it on a computer with .Net 2.0 (but without .Net 1.1
, as it should be used)

and I got the following error -

System.InvalidCastException: Unable to cast COM object of type
'mshtml.HTMLBodyClass' to class type ''. COM components that enter the
CLR and do not support IProvideClassInfo or that do not have any interop
assembly registered will be wrapped in the __ComObject type. Instances
of this type cannot be cast to any other class; however they can be cast
to interfaces as long as the underlying COM component supports
QueryInterface calls for the IID of the interface.
at xxNamespace3.mcFontOrColorsChanged(Boolean isRefreshText)
...
at xxNamespace1.Main()

'-- error till here.

My relevant code:

Public Sub mcFontOrColorsChanged(ByVal isRefreshText As Boolean)
Dim doc As mshtml.HTMLDocument = ...
If (doc Is Nothing) Then Return
If (doc.all.length = 0) Then Return
If (doc.styleSheets Is Nothing) Then Return
If (doc.styleSheets.length = 0) Then Return
Dim docStyleSheet As mshtml.IHTMLStyleSheet =
CType(doc.styleSheets.item(0), mshtml.IHTMLStyleSheet)
Dim docStyleRules As mshtml.HTMLStyleSheetRulesCollection =
CType(docStyleSheet.rules, mshtml.HTMLStyleSheetRulesCollection)
... ' more code
Dim docBody As mshtml.HTMLBodyClass = CType(doc.body,
mshtml.HTMLBodyClass)
If Not (docBody Is Nothing) Then
... ' more code

'-- code till here.

My questions:
1. Why do I have casting problem only for 'mshtml.HTMLBodyClass' , but
no error for 'mshtml.IHTMLStyleSheet' casting ?
2. Will it help if I only change 'Microsoft.mshtml.dll' in my exe
directory ?
3. Where can I find 'Microsoft.mshtml.dll' for .Net 2.0 ?
4. Is there a link I can see the difference in MSHTML classes using .Net
2.0 vs. using .Net 1.1 ?
5. Did anyone else tried to run a VS 2003 app using MSHTML with .NET 2.0
? Did you have any problems ?
Thanks,
Atara.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #1
0 2212

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

Similar topics

1
by: Shangwu | last post by:
Hello, Hello, I am using Visual Studio .NET 2003 on both a desktop computer and a laptop computer with Windows XP SP2. I have an ATL project with interface implemented. Both the main project...
6
by: Peter Afonin | last post by:
Hello: I'm running Windows server 2003. I've never had any problems with debugging, but now I cannot debug ANY of my projects. I'm getting this error: "Error while trying to run project:...
4
by: Daniel Sitima | last post by:
I cannot to create project in Windows Server 2003 with Visual Studio .NET 2003; The error returned was: The default Web access mode for this project is set to file share, but the project...
1
by: Jack G | last post by:
I've been trying to create a new web application project in Visual Studio 2003 running on a Windows Server 2003. I get the message Window titled Web Access Failed The default Web access mode for...
5
by: Atara | last post by:
I am trying to convert the following code to VB .Net, I still have some gaps (the lines that are marked with (*)) and also I need an ending condition for the while loop. any help would be...
1
by: DK - Minneapolis | last post by:
I am trying to use the Web Browser in a VB .Net windows application to host external web sites. I have a problem when I try and capture one of the document objects events. I used the KB 311284...
6
by: JonSteng | last post by:
..Net Visual Studio Professional 2003 Version 7.1.3088 ..Net Framework 1.1 SP1 Version 1.1.4322 IIS 5.1 Windows XP Professional SP2 Micron T3000 Laptop (1.5 GHz; 1GB RAM; 40GB HD with 17GB Free)...
2
by: Paul Hemans | last post by:
I am very new at .Net. I have a small project where I need to manipulate the contents of a web page. I have a form with a web browser control (webBrowser1) on it. Within the...
1
by: vhrao | last post by:
I created asp.net project with location http://localhost/proj1, which works fine. Now I found out that I have to change port from 80 to 8080. I changed TCP port for deafult website from 80 to...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.