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.
Visual Basic.NET

Avatar of undefined
Last Comment
searchsanjaysharma

8/22/2022 - Mon
nepaluz

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()
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.
searchsanjaysharma

ASKER
This i also know. i want a script. secondly, i have to destroy the application not just close the window.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Mike Tomlinson

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?
searchsanjaysharma

ASKER
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
Mike Tomlinson

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
searchsanjaysharma

ASKER
ok, instead of script consider program
Mike Tomlinson

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?
Jacques Bourgeois (James Burger)

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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER CERTIFIED SOLUTION
Ark

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
searchsanjaysharma

ASKER
ok