Do visual basic forms each run in separate memory?
Do visual b开发者_JAVA技巧asic forms each run in separate memory and if not is there a way that I can force them to do so. I want them to be in separate memory so that if one form freezes the entire program won't.
You're really asking about separate threads rather than separate memory. If you have several forms within the same application, they will usually run within the same thread. While you can force each window to use a different thread, that will make your life much more complicated at other times.
I would recommend that instead of trying to work around the problem of one form freezing, you simply fix it so that it doesn't freeze. To do that, you should avoid doing significant amounts of work on the UI thread - you should use background threads or asynchronous operations to avoid blocking the UI thread.
Jon Skeet's gives you the idea but here's the specific class & code snippet to create responsive UI.
class: BackgroundWorker
code snippet: Using BackgroundWorker class for long running processes in WPF or Silverlight
精彩评论