Using axwebbrowser control and thread locking app

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tim2006
    New Member
    • Oct 2008
    • 1

    Using axwebbrowser control and thread locking app

    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
    [code=vbnet]
    Imports System.Windows. Forms
    Imports System.Threadin g

    Public Class Class1
    Public Shared form1 As New Form1

    Shared Sub Main(ByVal Args() As String)
    Dim t2 As Thread

    t2 = New Thread(AddressO f screen)
    t2.Start()

    End Sub
    Shared Sub screen()

    form1.ShowDialo g()
    End Sub
    End Class
    [/code]
    Form
    [code=vbnet]
    Public Class Form1
    Inherits System.Windows. Forms.Form

    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeCompo nent()

    'Add any initialization after the InitializeCompo nent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Disp ose()
    End If
    End If
    MyBase.Dispose( disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.Componen tModel.IContain er

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWeb Browser
    Friend WithEvents Button1 As System.Windows. Forms.Button
    <System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
    Dim resources As System.Resource s.ResourceManag er = New System.Resource s.ResourceManag er(GetType(Form 1))
    Me.AxWebBrowser 1 = New AxSHDocVw.AxWeb Browser
    Me.Button1 = New System.Windows. Forms.Button
    CType(Me.AxWebB rowser1, System.Componen tModel.ISupport Initialize).Beg inInit()
    Me.SuspendLayou t()
    '
    'AxWebBrowser1
    '
    Me.AxWebBrowser 1.Enabled = True
    Me.AxWebBrowser 1.Location = New System.Drawing. Point(48, 24)
    Me.AxWebBrowser 1.OcxState = CType(resources .GetObject("AxW ebBrowser1.OcxS tate"), System.Windows. Forms.AxHost.St ate)
    Me.AxWebBrowser 1.Size = New System.Drawing. Size(300, 150)
    Me.AxWebBrowser 1.TabIndex = 0
    '
    'Button1
    '
    Me.Button1.Loca tion = New System.Drawing. Point(440, 72)
    Me.Button1.Name = "Button1"
    Me.Button1.TabI ndex = 1
    Me.Button1.Text = "Button1"
    '
    'Form1
    '
    Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
    Me.ClientSize = New System.Drawing. Size(584, 272)
    Me.Controls.Add (Me.Button1)
    Me.Controls.Add (Me.AxWebBrowse r1)
    Me.Name = "Form1"
    Me.Text = "Form1"
    CType(Me.AxWebB rowser1, System.Componen tModel.ISupport Initialize).End Init()
    Me.ResumeLayout (False)

    End Sub

    #End Region

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    'Me.AxWebBrowse r1.Navigate("ht tp://www.ibm.com")
    End Sub
    End Class[/code]
    Last edited by Frinavale; Oct 9 '08, 02:56 PM. Reason: added [code] tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    question moved to .net forum

    Comment

    Working...