Re: VB.NET code to C# code



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
> >
> >
> >
> >
> >
> >
>
.



Relevant Pages

  • Re: how to connect HP4194A to a printer
    ... buy some HPIB to parallel converter to interface the printer. ... I would like to use the I/O 8bit port available at the back ...
    (sci.electronics.equipment)
  • Re: how to connect HP4194A to a printer
    ... buy some HPIB to parallel converter to interface the printer. ... I would like to use the I/O 8bit port available at the back ...
    (sci.electronics.equipment)
  • Re: DS15 systems have arrived
    ... the ps/2 interface is one of the horrendous kludges from the PC ... > with a USB dongle. ... > There is a company called PI that sells a true converter called a Y-mouse ... >> that keyboard or mouse. ...
    (comp.os.vms)
  • Re: linux and rs-485
    ... > If you are happy for your PC to use two tranceivers, get a converter ... Opto-22 used to have a good line of converters and repeaters ... The repeaters were particularly handy, ... to convert from a 4-wire interface to a 2-wire interface. ...
    (comp.os.linux)
  • Re: linux and rs-485
    ... > If you are happy for your PC to use two tranceivers, get a converter ... Opto-22 used to have a good line of converters and repeaters ... The repeaters were particularly handy, ... to convert from a 4-wire interface to a 2-wire interface. ...
    (comp.os.linux.hardware)

Loading