Link to home
Start Free TrialLog in
Avatar of searchsanjaysharma
searchsanjaysharma

asked on

How to create a program that destroy ifself on button close, and reactive itself on running a script.

I have a form in VB.Net, it inserts the data into database.
I want when i click on close button, it should get deleted or hidden in such a manner that no one should be able to locate it, i.e exe file.
And when i run a script, it should get reactivated.
Is it possible.
Do we have any chaining process as we used to have in Qbasic. If any1 know this.
Avatar of nepaluz
nepaluz
Flag of United Kingdom of Great Britain and Northern Ireland image

To close the applcation, in the Button's click event, call Me.Close()
To start the application from a script, call the application.start equivalent from the script. If you pass any arguments to the application, make sure you handle them in the main thread's Sub New()
Avatar of Mike Tomlinson
You could create an Application Setting flag, a boolean, (which is stored internally and gets persisted across runs) that determines if the app should simply exit without doing anything.  You could set that flag when the app is closed.  From the script, you can call the app and pass it a parameter that tells it run normally.  Then, if the app is run directly without the parameter, it will simply exit.
Avatar of searchsanjaysharma
searchsanjaysharma

ASKER

This i also know. i want a script. secondly, i have to destroy the application not just close the window.
How can the program be recreated if it was destroyed?!...

Also, you can't destroy or rename the app while it is running (or in the act of closing).  This would have to be done from a secondary application (or script).

Can you give more details about what you're actually doing?
Just take the following example.
I have a calculator. Ok. When i close it should get hidden or destroyed. or rename. When i run another script it should be again activated
What's keeping the user from running the script that re-activates it?...

By "script", are you talking VBScript (.vbs)?  You can launch the app with a script that waits for the app to exit and then renames it.
ok, instead of script consider program
Ok...but if a secondary app unlocks the primary app by simply being run, what is keeping the user from directly running the secondary app?
If the users are connected full time, you could deploy the application through ClickOnce.

ClickOnce has an option to make the application available only online.

When the use starts the application, it gets installed temporarily on his computer if he is connected, otherwise he is told that he needs to be connected in order to use it.

When the application stops, it uninstalls automatically, but the Start menu icon that was created on the first installation stays there so that the user can restart the application.

This slows down the application when it starts because it needs to be reinstalled, but is if is a simple one, the process is not too long, not much longer than starting an Office application for instance.

Lookup ClickOnce in the documentation, on simply explore the Publish tab in the Project's properties window. For simple installation, just looking at the options in the Publish tab is self explanatory.
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial