Real Software Forums
http://forums.realsoftware.com/

Remember Info
http://forums.realsoftware.com/viewtopic.php?f=4&t=27969
Page 1 of 1

Author:  Frankoman [ Sun May 10, 2009 1:43 pm ]
Post subject:  Remember Info

How do I make RealBasic remember a piece of info for the programs session? I want to have the player enter in a name into an editfield, then later on have to recall what they entered in.

Thanks,
Frankoman

Author:  dglass [ Sun May 10, 2009 2:15 pm ]
Post subject:  Re: Remember Info

Just while the application is running?

Make a property in the App class, and set it to either Global or Protected.

When the user enters their name set the App property to that value. Then you just reference that property as needed.

Author:  Frankoman [ Sun May 10, 2009 2:42 pm ]
Post subject:  Re: Remember Info

I'm not quite sure on what I would enter in the App Property. What would the declaration be if I don't know the name they enter? Would I make it, say, x, then have whatever they enter be replaced with x, then call on x when needed? If so how would I replace what they type with x?

Author:  dglass [ Sun May 10, 2009 2:46 pm ]
Post subject:  Re: Remember Info

You make a property declaration....

App->Add Property

strUserName As String = "DefaultName"

When the user enters their name you do something like:

strUserName = UserNameField.Text 'UserNameField is an editfield

Then, whenever you need to use the username you reference strUserName

Author:  classone [ Sun May 10, 2009 9:02 pm ]
Post subject:  Re: Remember Info

When questions as basic as how to save a value to a variable crop up, I can't resist the urge to advise the OP to work through the tutorials and read a good book on RB in order to learn the basics. Trying to learn basic (or BASIC) programming by posting each question that occurs to this Forum can be a quite laborious and painful process.

Just my .02 FWIW

Author:  HiddenPaw [ Sun May 10, 2009 10:39 pm ]
Post subject:  Re: Remember Info

i agree definitely work thru the tutorials

or at least pick some of the simple included example programs and just play around modifying them

not as good as the tutorials but more fun

Author:  DaveS [ Sun May 10, 2009 10:40 pm ]
Post subject:  Re: Remember Info

Dang... if you cannot grasp the concept of "named variables", there is no way you will ever be able to write even the simplest of programs, in this or any other language.

Author:  computerfreaker [ Fri Jun 12, 2009 12:06 pm ]
Post subject:  Re: Remember Info

DaveS wrote:
Dang... if you cannot grasp the concept of "named variables", there is no way you will ever be able to write even the simplest of programs, in this or any other language.

Well & accurately said, Dave. Frankoman, you've got to learn to use variables or you won't be able to program anything in ANY language. Try the RB Language Reference & Tutorials, play around with the example programs... try some simple hello world stuff... generally stay simple & fun until you get the hang of it, then go for the complex & serious stuff. :)

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/