By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,474 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,474 IT Pros & Developers. It's quick & easy.

Using axwebbrowser control and thread locking app

P: 1
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
Share this Question
Share on Google+
1 Reply


debasisdas
Expert 5K+
P: 8,127
question moved to .net forum
Oct 9 '08 #2

Post your reply

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