How do I...?

Persist Data Across Sessions

It is often nice to add a personal touch to your Application, such as greeting the user by name whenever your application is run.

As an example, we will create an application that prompts the user for their name the first time it is run, and stores that data in the registry. Every subsequent time that the application is run, it will greet the user with the name that they have inputted:

  1. Place the following code in your Project's On Startup event:

user = Application.LoadValue("Information", "Name");
if user == "" then
    user = "Unknown User";
    user = Dialog.Input("Information Requested", "Please enter your full name:", "", MB_ICONQUESTION);
    Application.SaveValue("Information", "Name", user);
end
Dialog.Message("Welcome", "Hello "..user..", welcome to my application");

Note: This example prompts the user to enter their full name the first time they run your application, and stores that value in the registry. Every subsequent time that the user runs your application a message will pop up on the screen greeting them by name.


Applies to:

Standard Edition

Professional Edition