Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Text command + a variable?

Author
Message
Turtle Productions
15
Years of Service
User Offline
Joined: 22nd Jan 2009
Location: Finland
Posted: 9th Oct 2010 13:57
Hey. I have used other BASIC language what has ability to use this:

Text x,y,"Money: "+money#

The variable money can be changed (in this example - money, you can buy a thing then it reduces the amount of money and so...)
But I haven't found any way to do this in DBPro. I know that I could use this with Print command but it is so buggy, I want use text, if possible. Is there a way to do it?

Thanks
TP
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Oct 2010 14:15
There is no automatical conversion between numerics to strings in DB.
You can achieve what you want by using the str$(value) function though.
Like so:


Similarily, you can also convert a string to a numeric value using the val(string$) function.

Turtle Productions
15
Years of Service
User Offline
Joined: 22nd Jan 2009
Location: Finland
Posted: 9th Oct 2010 20:49
Thank you very much, Rudolpho!

Thanks,
TP
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Oct 2010 11:55
plus if you do this str$(money#,2) will show two decimal places.

Dark Physics makes any hot drink go cold.
Turtle Productions
15
Years of Service
User Offline
Joined: 22nd Jan 2009
Location: Finland
Posted: 16th Oct 2010 11:25
Thanks a lot HowDo, that was a thing in a very need
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 17th Oct 2010 18:18
I think you would be better of using integers for money, and inserting the decimal place after you've converted it to a string.

Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 18th Oct 2010 05:03
Cheers for that tip Howdo, str$(money#,2) will produce two decimal places! Awesome stuff.

Login to post a reply

Server time is: 2024-11-24 09:42:53
Your offset time is: 2024-11-24 09:42:53