473,545 Members | 666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.InvalidC astException: Unable to cast COM object of type
'mshtml.HTMLBod yClass' to class type ''. COM components that enter the
CLR and do not support IProvideClassIn fo 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.mc FontOrColorsCha nged(Boolean isRefreshText)
...
at xxNamespace1.Ma in()

'-- error till here.

My relevant code:

Public Sub mcFontOrColorsC hanged(ByVal isRefreshText As Boolean)
Dim doc As mshtml.HTMLDocu ment = ...
If (doc Is Nothing) Then Return
If (doc.all.length = 0) Then Return
If (doc.styleSheet s Is Nothing) Then Return
If (doc.styleSheet s.length = 0) Then Return
Dim docStyleSheet As mshtml.IHTMLSty leSheet =
CType(doc.style Sheets.item(0), mshtml.IHTMLSty leSheet)
Dim docStyleRules As mshtml.HTMLStyl eSheetRulesColl ection =
CType(docStyleS heet.rules, mshtml.HTMLStyl eSheetRulesColl ection)
... ' more code
Dim docBody As mshtml.HTMLBody Class = CType(doc.body,
mshtml.HTMLBody Class)
If Not (docBody Is Nothing) Then
... ' more code

'-- code till here.

My questions:
1. Why do I have casting problem only for 'mshtml.HTMLBod yClass' , but
no error for 'mshtml.IHTMLSt yleSheet' casting ?
2. Will it help if I only change 'Microsoft.msht ml.dll' in my exe
directory ?
3. Where can I find 'Microsoft.msht ml.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 2222

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

Similar topics

1
3037
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 and PS project can be built on my desktop computer. But I cannot build the PS project on my laptop computer. I always get the following output from...
6
1857
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: Unable to start debugging on the web server. Access is denied." The only thing I've done recently was installing all the latest Microsoft
4
1697
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 folder at 'http://localhost/WebApplication1' cannot be opened with the path 'd:\inetpub\wwwroot\WebApplication1'. The error returned was: Unable to...
1
1511
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 this project is set to file share, but the project folder at http://localhost/NewWebPage cannot be opened witht he path 'G:\Zoning\NewWebPage' the...
5
10880
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 appreciated. Thanks. Atara. ------------------------- Original code:
1
1527
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 "How to handle...VB .Net". coied all the code into my version of VS 2003. The code contains "AddHandler..." code, when active doesn't allow the...
6
3353
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) I installed FrontPage server extensions to IIS on my computer while following instructions in a Microsoft ASP.Net MCSD training book. After...
2
14788
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 webBrowser1_DocumentCompleted method I have the following code. mshtml.HTMLDocument oDoc = new HTMLDocumentClass(); oDoc = (mshtml.HTMLDocument)webBrowser1.Document;
1
1799
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 8080 and restarted IIS. Checked http://localhost:8080 works fine. I tried opening my project and VS.NET 2003 cannot open my project, gives error:...
0
7467
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7807
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7419
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5326
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.