Re: VB.NET code to C# code
- From: "David Anton" <DavidAnton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Jul 2005 07:49:01 -0700
See the translation via Instant C# in my other reply.
Not sure you've noticed, but the code produced by the online converter you
used is not C# code.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
"Matt" wrote:
> Try this:
>
> using System.Runtime.InteropServices;
> [ComVisible(true)]
> [ComImport()]
> [Guid("7FD52380-4E07-101B-AE2D-08002B2EC713")]
> [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
> public interface IPersistStreamInit {
>
> // IPersist interface
> void GetClassID(ref Guid pClassID);
>
> public class dom_lib {
>
> public string Fun() {
> mshtml.HTMLDocument objMSHTML;
> mshtml.IHTMLDocument2 objDocument;
> IPersistStreamInit ips;
> objMSHTML = new mshtml.HTMLDocument();
> objMSHTML;
> IPersistStreamInit;
> ips.InitNew();
> objDocument = objMSHTML.createDocumentFromUrl("http://microsoft.com/", String.Empty);
> for (
> ; (objDocument.readyState == "complete");
> ) {
> Application.DoEvents();
> }
> return objDocument.body.outerHTML;
> }
> }
> }
>
>
> NG wrote:
>
> >Hi All
> >Can anyone pls help me convert the following VB.NET code to C#.
> >This uses MSHTML and an Interface definition.
> >Thanks
> >NG
> >
> >Option Explicit On
> >Option Strict On
> >
> >Imports System.Runtime.InteropServices
> >
> ><ComVisible(True), ComImport(),
> >Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), _
> >InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
> >Public Interface IPersistStreamInit
> > ' IPersist interface
> > Sub GetClassID(ByRef pClassID As Guid)
> >
> > <PreserveSig()> Function IsDirty() As Integer
> > <PreserveSig()> Function Load(ByVal pstm As UCOMIStream) As Integer
> > <PreserveSig()> Function Save(ByVal pstm As UCOMIStream, ByVal
> >ByValfClearDirty As Boolean) As Integer
> > <PreserveSig()> Function GetSizeMax(<InAttribute(), Out(),
> >MarshalAs(UnmanagedType.U8)> ByRef pcbSize As Long) As Integer
> > <PreserveSig()> Function InitNew() As Integer
> >
> >End Interface
> >
> >
> >
> >
> >
> >Imports System.Windows.Forms
> >
> >Public Class dom_lib
> > Public Function Fun() As String
> >
> >
> > Dim objMSHTML As mshtml.HTMLDocument
> > Dim objDocument As mshtml.IHTMLDocument2
> > Dim ips As IPersistStreamInit
> >
> > objMSHTML = New mshtml.HTMLDocument
> >
> > ips = DirectCast(objMSHTML, IPersistStreamInit)
> > ips.InitNew()
> >
> > objDocument =
> >objMSHTML.createDocumentFromUrl("http://microsoft.com/", String.Empty)
> >
> > Do Until objDocument.readyState = "complete"
> > Application.DoEvents()
> > Loop
> >
> > Fun = objDocument.body.outerHTML
> >
> > End Function
> >
> >End Class
> >
> >
> >
> >
> >
> >
>
.
- References:
- VB.NET code to C# code
- From: NG
- Re: VB.NET code to C# code
- From: Matt
- VB.NET code to C# code
- Prev by Date: RE: VB.NET code to C# code
- Next by Date: executescalar()
- Previous by thread: Re: VB.NET code to C# code
- Next by thread: Re: VB.NET code to C# code
- Index(es):
Relevant Pages
|
Loading