VB code equivalent in c#.net...
-
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.
-
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.
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!
-
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!
thanks Steve Echols.
-
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 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