Board index » Visual Studio » Using Multi-threading

Using Multi-threading

Visual Studio262
Hi,



I am designing an interface which allows users to load certain files

into the interface. While the file is loading, I want to display a

VB.NET form with the list of messages generated during the process. I

want the form to be displayed during the loading process and the

messages to appear one after another as they are generated in the

back-end. I'm pretty sure I need to use multi-threading for this but

I am having a lot of trouble figuring out how to do it.



I think part of my problem might be that the function which displays

the form and adds the messages to the form gets called on an

as-needed-basis instead of in a step-by-step process.



Does anyone have any advice or ideas on how I can approach this

problem??



Thanks!!



Joy


-
 

Re:Using Multi-threading

If this is a windows application you can just create a splash screen that

has a status bar that you change. The splach screen loads all the objects

and then shows the main form. It would be best to do this inside a main

method in a seperate class.



<STAThread()>_



Shared Sub Main()



Dim frm As New frmMain



Dim frmSplash As New SplashScreen



frmSplash.Show()



frm.LoadMemory(True, frmSplash.StatusBar1)



frm.LoadLocationData(frmSplash.StatusBar1)



frm.LoadWellMobileData(frmSplash.StatusBar1)



frm.LoadCallSheetData(frmSplash.StatusBar1)



frm.LoadForm(frm)



frmSplash.Close()



' Call the Application class' Run method



' passing it the Form1 object created above.



Application.Run(frm)



End Sub





<simchajoy2000@yahoo.com>wrote in message

Quote
Hi,



I am designing an interface which allows users to load certain files

into the interface. While the file is loading, I want to display a

VB.NET form with the list of messages generated during the process. I

want the form to be displayed during the loading process and the

messages to appear one after another as they are generated in the

back-end. I'm pretty sure I need to use multi-threading for this but

I am having a lot of trouble figuring out how to do it.



I think part of my problem might be that the function which displays

the form and adds the messages to the form gets called on an

as-needed-basis instead of in a step-by-step process.



Does anyone have any advice or ideas on how I can approach this

problem??



Thanks!!



Joy





-

Re:Using Multi-threading

I'm not sure this is what you are talking about but I just did something

similar with uploading to an ftp site. Basically what I did is created a

progress form that had a status property and then had this in click of the

upload button

oProgress = new progress

oProgress.Status = "Connecting"

oProgress.Show

ftpThread = New System.threading.thread(addressof UploadFTP)



then in my UploadFTP method I had this



oProgress.status = "Uploading File A"

'Upload file A

oProgress.status = "Uploading File B"

'Upload file B

oProgress.status = "Uploading File C"

'Upload file C

oProgress.status = "Uploading File D"

'Upload file D



This kept the program from looking like it was "Not Responding" and allowed

me to add a cancel button also.







<simchajoy2000@yahoo.com>wrote in message

Quote
Hi,



I am designing an interface which allows users to load certain files

into the interface. While the file is loading, I want to display a

VB.NET form with the list of messages generated during the process. I

want the form to be displayed during the loading process and the

messages to appear one after another as they are generated in the

back-end. I'm pretty sure I need to use multi-threading for this but

I am having a lot of trouble figuring out how to do it.



I think part of my problem might be that the function which displays

the form and adds the messages to the form gets called on an

as-needed-basis instead of in a step-by-step process.



Does anyone have any advice or ideas on how I can approach this

problem??



Thanks!!



Joy





-