VB Form - Multithreading?
-
I have created the following in VB.Net2003: I have a working form that I think has all necessary properties, methods, and procedures to do what I want it to do. In other words, I have it so that it will appear when I press a button on another "parent" form, and will close when I click its close button. I want to be able to create many instances of this form from the "parent" form and I want them to work independently and close independently, but be able to communicate back and forth (send and get strings and other objects) with the "parent" form. I would also like them all to close, each having the chance to save information, when the "parent" form is closed. I think that in order to do this I may need to do multi-threading, making each new instance in a new thread - but I don't think I want to go through multi-threading. Would a collection work? Any help on either of these concepts or anything else that you might think would allow me to accomplish this would be greatly appeciated.
sincerely, Brett Peirce - PolerBear To err is human; To forgive: divine.
-
I have created the following in VB.Net2003: I have a working form that I think has all necessary properties, methods, and procedures to do what I want it to do. In other words, I have it so that it will appear when I press a button on another "parent" form, and will close when I click its close button. I want to be able to create many instances of this form from the "parent" form and I want them to work independently and close independently, but be able to communicate back and forth (send and get strings and other objects) with the "parent" form. I would also like them all to close, each having the chance to save information, when the "parent" form is closed. I think that in order to do this I may need to do multi-threading, making each new instance in a new thread - but I don't think I want to go through multi-threading. Would a collection work? Any help on either of these concepts or anything else that you might think would allow me to accomplish this would be greatly appeciated.
sincerely, Brett Peirce - PolerBear To err is human; To forgive: divine.
really no. well it may depends in some special occasion that a separate thread would be needed, depending on the thing your form do, but generally not. There are many way for doing it, anyway the basic solution to a have a Myforms() As Form in you BIG application and when the user wants a new one Redim preserve myforms(myforms.length) Myforms(myforms.lenght-1) = new yoursmallform() myforms(myforms.lenght-1).show and .. well for the data exchange with the parent form.. i think here also there are many way. i just don't know.. i think after all there is some way across the .net a system for the forms to communicate... between the many ways i see for the comunications 2 are interesting in my point of view.. one is with a tcp/ip loopback connection (you may also use a small library of mine, posted here on codeproject, for doing this), but this is definetly not so efficent. a better way (considering that you don't want to loose yourself into the .net) may be simply implement your event that may be easily thrown by the small form, and easily captured from the big one. didn't you try this? <- true inside to understand outside ->