142 CHAPTER 5 (Hosting your own web site) STORING AND RETRIEVING APPLICATION

142 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Retrieving Property Values In addition to assigning a value to a property, you can also retrieve it using the following syntax. Result = ObjectName.PropertyName Here, the value assigned to the PropertyName is assigned to a variable named Result. For example, the following statement retrieves the value assigned to the Caption Property of the PushButton1 control x = PushButton1.Caption If the Property resides on a different window, you would have to modify this statement, as the following shows. x = Window2.PushButton1.Caption Creating and Working with Variables When you need to store and retrieve individual pieces of data that are not directly associated with an object, such as a control, you will want to store them in regular variables. REALbasic enables you to create variable names of any length. Variables names are not case-sensitive, so as far as REALbasic is concerned, TEMP, tEMP, and TeMp are all the same. REALbasic does impose a few rules on the creation of variable names, as shown in the following list: Variable names must begin with a letter. Variable names can only contain uppercase and lowercase alphabetic characters and numbers. Variable names cannot contain blank spaces. Reserved words cannot be used as variable names. Defining Variables and Assigning Data Two steps are involved in creating a variable. For starters, you must declare the variable using the Dim statement. In declaring a variable, you give it a name and specify the type of data it will store. The following shows the syntax of the Dim statement. Dim VariableName As DataType For example, the following statement declares a variable named strUserName that will hold string data. Dim strUserName As String Once you declare a variable, you can assign data to it, as the following shows. strUserName = “Alexander Ford”
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

Leave a Reply