Visual Basic 2008 - a new form in another topic

My "form1" is just a page with buttons that launch different forms that do all the work, the code is "form1" for the first four buttons below.

I want each form to run in a separate thread.

Public Class Main
    Private Sub btnDownLoadStockPrices_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDownLoadStockPrices.Click
        LoadStocksFromDownloadSite.Visible = True
    End Sub

    Private Sub btnLoadOptionsIntoDatabase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadOptionsIntoDatabase.Click
        LoadOptionsIntoDatabase.Visible = True
    End Sub

    Private Sub btnVerifyDatabases_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVerifyDatabases.Click
        VerifyDatabase.Visible = True
    End Sub

    Private Sub btnAnalyzeStock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyzeStock.Click
        AnalyzeSingleStock.visible = True
    End Sub
End Class

Ive found many code examples to have different buttons in one form, to run a subroutine in a separate thread, but for some reason I can’t apply it to the whole form.

I think this is something simple, for example, I need to associate each new thread as a routine descriptor for each form, but I just can't get it to work. I don’t care at all about the "synchronization" of threads, since each form is really a completely different functional program.

Any help would be very helpful!

+3
2

; . , , Windows API. [] - , , , , , .

- Application.Run .NET Framework . :

Dim frm As Form1 = New Form1()
Application.Run(frm)

, , , . Show , . , ShowDialog, . , .

, - . (BackgroundWorker ) , Invoke.

+3

, Win32, , .net.

, . , , . , , , , . .

, , , . , .

, . . , . .

, - ! , , .

+1

Source: https://habr.com/ru/post/1790455/


All Articles