English 中文(简体)
VB.net 简单多读
原标题:VB.net Simple Multithreading

我有一个私人附属基金,它试图从纽特纳呼吁,其形式为:

Dim t1 As System.Threading.Thread = New System.Threading.Thread(AddressOf Me.Fill)

t1.Start()

然而,当我管理该方案时,情况就没有发生。 我多次点击了纽特,正在处决该功能。 什么? 粉碎机功能基本上是从电子电子计算机进入一个文本箱的输出方,在清单箱中进行控制并产生结果。

Can anyone help me get this working? I d appreciate the help. EDIT: Below, is the Fill function that I am trying to get working. The function itself works, when i try it without multithreading. But not with it...

Private Sub Fill()
    Try
        For Each links In ListBox2.Items
            Dim blah As Boolean = False
            Do While blah = False
                Application.DoEvents()
                If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
                    blah = True
                    WebBrowser1.Navigate(links)
                    Application.DoEvents()
                    Me.Refresh()
                     OUTPUT THE REGEX IN RTB
                    Try
                        RichTextBox1.Text = WebBrowser1.Document.Body.OuterHtml
                        RichTextBox1.Update()
                        Application.DoEvents()
                        Me.Refresh()
                         INTRODUCE REGEX
                        If CheckBox1.Checked = True Then
                            Dim R As New Regex("</H3>&lt;.*gt;")
                            For Each M As Match In R.Matches(RichTextBox1.Text)
                                Dim email As String = M.Value.Substring(9).Split("&;").GetValue(0).ToString
                                ListBox1.Items.Add(email)
                            Next
                        End If
                    Catch ex As Exception
                        Label1.Text = "Error recieved. Program will not stop"
                        Me.Refresh()
                    End Try
                    Application.DoEvents()
                    Me.Refresh()
                End If
            Loop
        Next
    Catch ex As Exception

    End Try
End Sub
问题回答

我认为,你有问题,因为你在试图书写Fill(Fill()方法中的文本箱时,你没有在天线上——这会造成一个例外。 为了解决这个问题,你需要利用BeginInvoke和代表,如以下例子:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim t1 As System.Threading.Thread = New System.Threading.Thread(AddressOf Me.Fill)
        t1.Start()

End Sub

Private Delegate Sub FillDelegate()

Private Sub Fill()
        If TextBox1.InvokeRequired Then
            TextBox1.BeginInvoke(New FillDelegate(AddressOf Fill))
        Else
            TextBox1.Text = "Worked!!!!"
        End If
End Sub

首先,在“Fill”方法内设一个断点。 我首先要问一下。

你们的布顿手稿在结尾处仍然有。 有时人们将布托顿割掉,然后把布托顿割掉到其他地方,这给民主选举学会留下了不满意的印象,并留下了手提的“孤儿”。





相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签