473,772 Members | 2,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using axwebbrowser control and thread locking app

1 New Member
When i try to run the program, it just hangs. If i remove the axwebbrowser control it works fine.

Any ideas?

Here is my code:

class1.vb
Expand|Select|Wrap|Line Numbers
  1. Imports System.Windows.Forms
  2. Imports System.Threading
  3.  
  4. Public Class Class1
  5.   Public Shared form1 As New Form1
  6.  
  7.   Shared Sub Main(ByVal Args() As String)
  8.     Dim t2 As Thread
  9.  
  10.     t2 = New Thread(AddressOf screen)
  11.     t2.Start()
  12.  
  13.   End Sub
  14.   Shared Sub screen()
  15.  
  16.     form1.ShowDialog()
  17.   End Sub
  18. End Class
  19.  
Form
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.  
  26.     'Required by the Windows Form Designer
  27.     Private components As System.ComponentModel.IContainer
  28.  
  29.     'NOTE: The following procedure is required by the Windows Form Designer
  30.     'It can be modified using the Windows Form Designer.  
  31.     'Do not modify it using the code editor.
  32.   Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser
  33.   Friend WithEvents Button1 As System.Windows.Forms.Button
  34.   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  35.     Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
  36.     Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser
  37.     Me.Button1 = New System.Windows.Forms.Button
  38.     CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit()
  39.     Me.SuspendLayout()
  40.     '
  41.     'AxWebBrowser1
  42.     '
  43.     Me.AxWebBrowser1.Enabled = True
  44.     Me.AxWebBrowser1.Location = New System.Drawing.Point(48, 24)
  45.     Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState"), System.Windows.Forms.AxHost.State)
  46.     Me.AxWebBrowser1.Size = New System.Drawing.Size(300, 150)
  47.     Me.AxWebBrowser1.TabIndex = 0
  48.     '
  49.     'Button1
  50.     '
  51.     Me.Button1.Location = New System.Drawing.Point(440, 72)
  52.     Me.Button1.Name = "Button1"
  53.     Me.Button1.TabIndex = 1
  54.     Me.Button1.Text = "Button1"
  55.     '
  56.     'Form1
  57.     '
  58.     Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  59.     Me.ClientSize = New System.Drawing.Size(584, 272)
  60.     Me.Controls.Add(Me.Button1)
  61.     Me.Controls.Add(Me.AxWebBrowser1)
  62.     Me.Name = "Form1"
  63.     Me.Text = "Form1"
  64.     CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit()
  65.     Me.ResumeLayout(False)
  66.  
  67.   End Sub
  68.  
  69. #End Region
  70.  
  71.   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  72.     'Me.AxWebBrowser1.Navigate("http://www.ibm.com")
  73.   End Sub
  74. End Class
Oct 9 '08 #1
1 1354
debasisdas
8,127 Recognized Expert Expert
question moved to .net forum
Oct 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1551
by: Lecture Snoddddgrass | last post by:
Hi, I noticed that my WinForms app was taking a while to start up. I stepped through the code to find out which line was causing the delay. The delay is occurring within one of my UserControls whose designer-generated InitializeComponent() method instantiates a web browser control and eventually calls EndInit() on it. It's that EndInit() call that takes several seconds to complete. What's odd is that my application makes extensive use...
11
3788
by: Doug Thews | last post by:
I've been working on some samples that use BeginInvoke/EndInvoke. In one example, I call BeginInvoke and pass it an AsyncCallback function pointer. I was messing around with ReaderWriterLocks and noticed that if I did this, it worked (please ignore the lack of try ... catch blocks, because I cut down the code to be more brief - I have a try...catch surround the AcquireWriterLock method): ---------- myLock.AcquireWriterLock(1000);...
2
2141
by: Andy Heitke | last post by:
My problem is similar to the thread entited, "SP2 kills my AxWebBrowser" except that I haven't been able to get the fixes to work for me. I've written an application that uses an embedded WebBrowser control for most of it's UI. (At the time it seemed like a good idea, but in retrospect I think it was more work than it was worth.) In it, I first navigate to about:blank, wait for the browser to be ready, and then write my html to the...
1
2320
by: Mantorok | last post by:
Hi Is there anyway to get a WebBrowser to work without placing it on a form. I want to be able to instantiate a browser, complete some of the fields and submit, but whenever I try to navigate I get: An unhandled exception of type 'InvalidActiveXStateException' occurred in axinterop.shdocvw.dll
0
1588
by: beau | last post by:
Hi, I'm using the AxWebBrowser in a C# WinForms application. I've got the basics working, but need some help controlling the view options for browsing files. How can I disable the "WebView"/Tasks pane on the left side of the file view? I've looked around and know it can be done globally from the registry
1
1231
by: MPR | last post by:
I'm displaying a web page with the navigate2 method of the axWebBrowser control. On the web page that is already in the axWebBrowser control, there are severla links, like in any other web page. I wanto to take one ot those links (programatically) follow that link, like emulating a click over it. Is it possible? There's somethink like a link collection or somethink like that?
13
4226
by: Udhay | last post by:
I am trying to use the AxWebbrowser control in my VB.Net application. The control is placed on one of the tab pages in the form. This is the error I am getting when I have the 'exceptions' set to break into the debugger: A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in system.windows.forms.dll Additional information: Unknown error
6
3768
by: Dave Booker | last post by:
It appears that I cannot correctly install the AxWebBrowser in VS2005. I can instantiate an "AxWebBrowser browser" and refer to its members, properties, and methods. I'm having trouble with the AxWebBrowser.Document: When I print browser.Document.GetType().ToString() at runtime, I get "mshtml.HTMLDocumentClass". But The VS2005 compiler does not recognize the member AxWebBrowser.Document as anything other than a System.Object -- e.g.,...
6
2377
by: Gina_Marano | last post by:
Hey All, I am using multiple child threads per main thread to download files. It sometimes appears as if the same file is being downloaded twice. I am using "lock". Am I using it correctly? Any blantant threading errors here? Any opinions would be greatly appreciated. namespace MainThreadManagement
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6716
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.