Hi,
Need some help on how to setup multi threading in a simple winforms application.
I have a simple WinForms application with a listbox. The app allows the user to open a text file, when the file is successfully opened its added to the list box.
I need to add some code that will fire an event when a filename in the listbox is double-clicked. The code should create a new thread and display a fixed size form which will display the file details e.g. file size, modified date, created etc.
I am able to do the above without threading, I have a generateForm function that programmatically creates a new form and adds in some label controls. The controls show the results of a small function that uses the System.IO namespace to interrogate the file attributes.
I need to add a timer control on the dynamically created forms which will auto update the file attributes every few seconds (to monitor the file attributes).
However when I try to have more than one form generated the app stutters as its waiting on each form to complete its event. To solve this I would like to generate each form with a timer however have each form contained in a thread. When the dynamic form is closed the thread is destroyed.
There is no interaction between the threaded forms and the main application. I don't have any experience with threaded applications so I am a bit stumped at the moment as to which approach to take.
Any help would be greatly appreciated.
Fz
Need some help on how to setup multi threading in a simple winforms application.
I have a simple WinForms application with a listbox. The app allows the user to open a text file, when the file is successfully opened its added to the list box.
I need to add some code that will fire an event when a filename in the listbox is double-clicked. The code should create a new thread and display a fixed size form which will display the file details e.g. file size, modified date, created etc.
I am able to do the above without threading, I have a generateForm function that programmatically creates a new form and adds in some label controls. The controls show the results of a small function that uses the System.IO namespace to interrogate the file attributes.
I need to add a timer control on the dynamically created forms which will auto update the file attributes every few seconds (to monitor the file attributes).
However when I try to have more than one form generated the app stutters as its waiting on each form to complete its event. To solve this I would like to generate each form with a timer however have each form contained in a thread. When the dynamic form is closed the thread is destroyed.
There is no interaction between the threaded forms and the main application. I don't have any experience with threaded applications so I am a bit stumped at the moment as to which approach to take.
Any help would be greatly appreciated.
Fz