I have read earlier posts in this forum and understand that the Close method does not work in the Open event.
The close method leaves an empty window on the screen.
I need to run a bunch of code in the window, but with the window in an invisible state under certain conditions.
Once the code has been executed, the window is closed.
Is there any other way to achieve it ?
My application contains several windows that have several methods each. The names of these methods are same in all windows. So to do a particular task I have to use the bunch of methods from a particular window.
That is the only reason, I wish to open the window in an invisible condition is to use the code available in the window without any user interaction.
It should be transparent to the user.
I would try to move the code in question out of the window so that it can be called independently. Creating an invisible instance of a window just to run some code in it could be a symptom of bad design.
[quote=369124:@Chellappan Palaniappan]My application contains several windows that have several methods each. The names of these methods are same in all windows. So to do a particular task I have to use the bunch of methods from a particular window.
That is the only reason, I wish to open the window in an invisible condition is to use the code available in the window without any user interaction.
It should be transparent to the user.
Any other solution please ?[/quote]
Instead of a Window, just create a class with your methods and then youll do something like this:
[quote=369133:@Greg O’Lone]Instead of a Window, just create a class with your methods and then youll do something like this:
dim runner as New CustomClass
Runner.RunMethod()[/quote]
Why a class? Why not call RunMethod direcly? Seems like unnecessary overhead to me, but since you know a lot more about programming than I do, I have to ask why
It reads like Tim and Greg are trying to get the code off of the window into a class, so that the code may be run without the window. Using an interface as Tim suggested would open the code to being more flexible, which may lead to needing less copy/paste code.