Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. VB code equivalent in c#.net...

VB code equivalent in c#.net...

Scheduled Pinned Locked Moved Windows Forms
csharpquestiongraphicshelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K V Sekhar
    wrote on last edited by
    #1

    Hi all, I am trying to write the following logic in c#.Please help me , i could not able to translate the Bolded code in the following logic. Code in VB.Net ============== Public Function ConvertPage(ByVal PageUrl As String) As Bitmap Me.PageUrl = PageUrl Dim thrCurrent As New Thread(New ThreadStart(AddressOf CreateImage)) thrCurrent.SetApartmentState(ApartmentState.STA) thrCurrent.Start() thrCurrent.Join() Return ConvertedImage End Function Private Sub CreateImage() Dim BrowsePage As New WebBrowser() BrowsePage.ScrollBarsEnabled = False BrowsePage.Navigate(PageUrl) AddHandler BrowsePage.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted While BrowsePage.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While BrowsePage.Dispose() End Sub What is Equivalent c# code for above bolded lines? Thanks in advance.

    Steve EcholsS S 2 Replies Last reply
    0
    • K K V Sekhar

      Hi all, I am trying to write the following logic in c#.Please help me , i could not able to translate the Bolded code in the following logic. Code in VB.Net ============== Public Function ConvertPage(ByVal PageUrl As String) As Bitmap Me.PageUrl = PageUrl Dim thrCurrent As New Thread(New ThreadStart(AddressOf CreateImage)) thrCurrent.SetApartmentState(ApartmentState.STA) thrCurrent.Start() thrCurrent.Join() Return ConvertedImage End Function Private Sub CreateImage() Dim BrowsePage As New WebBrowser() BrowsePage.ScrollBarsEnabled = False BrowsePage.Navigate(PageUrl) AddHandler BrowsePage.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted While BrowsePage.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While BrowsePage.Dispose() End Sub What is Equivalent c# code for above bolded lines? Thanks in advance.

      Steve EcholsS Offline
      Steve EcholsS Offline
      Steve Echols
      wrote on last edited by
      #2

      This may or may not get you going: Thread thrCurrent = new Thread(new ThreadStart(CreateImage)); BrowsePage.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted); private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e ) { ... }


      - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

      • S
        50 cups of coffee and you know it's on!
        Code, follow, or get out of the way.
      K 1 Reply Last reply
      0
      • Steve EcholsS Steve Echols

        This may or may not get you going: Thread thrCurrent = new Thread(new ThreadStart(CreateImage)); BrowsePage.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted); private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e ) { ... }


        - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

        K Offline
        K Offline
        K V Sekhar
        wrote on last edited by
        #3

        thanks Steve Echols.

        1 Reply Last reply
        0
        • K K V Sekhar

          Hi all, I am trying to write the following logic in c#.Please help me , i could not able to translate the Bolded code in the following logic. Code in VB.Net ============== Public Function ConvertPage(ByVal PageUrl As String) As Bitmap Me.PageUrl = PageUrl Dim thrCurrent As New Thread(New ThreadStart(AddressOf CreateImage)) thrCurrent.SetApartmentState(ApartmentState.STA) thrCurrent.Start() thrCurrent.Join() Return ConvertedImage End Function Private Sub CreateImage() Dim BrowsePage As New WebBrowser() BrowsePage.ScrollBarsEnabled = False BrowsePage.Navigate(PageUrl) AddHandler BrowsePage.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted While BrowsePage.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While BrowsePage.Dispose() End Sub What is Equivalent c# code for above bolded lines? Thanks in advance.

          S Offline
          S Offline
          Steven A Lowe
          wrote on last edited by
          #4

          Steve Echols already answered your specific question, but you might find http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx a useful resource in future.

          Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups