Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

TextBox.Text Average?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2008, 10:11 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default TextBox.Text Average?

How do I get a average of .125 or less In a TextBox?
And can I center the text in a TextBox?
Reply With Quote
  #2 (permalink)  
Old 04-25-2008, 05:48 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

What do you mean with getting an average?

You can change the text alignment with FormLib.TextAlignment.
Reply With Quote
  #3 (permalink)  
Old 04-25-2008, 01:23 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

Thanks for the text alignment help Erel.

By average I mean that I get something like 50.1246887 in my TextBox but I need
50.125.
If I resize the TextBox to fit then I may need a diffrent value at some point like 23.5 in which case the TextBox would then read 23.495 which I do not need.
Reply With Quote
  #4 (permalink)  
Old 04-25-2008, 01:36 PM
Junior Member
 
Join Date: May 2007
Location: Germany
Posts: 45
Default

Hi cdeane,

What you need, I think, is
round(yourValue,3)
for 3 digits.

val = 56.123432
textbox.text = round(val,3)
delivers 56.123

I hope I'm right and this helps

regards
Bernd
Reply With Quote
  #5 (permalink)  
Old 04-25-2008, 02:53 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Or you can use the format function:

Code:
Msgbox (Format(1234.5678,"N2"))
Will display: 1,234.57


specci48
Reply With Quote
  #6 (permalink)  
Old 04-25-2008, 04:44 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

I do not know what value the TextBox will throug out at any given time.

I need someting like : Round(TextBox.Text,2)
Which of course dose not seem to work.
Reply With Quote
  #7 (permalink)  
Old 04-25-2008, 05:09 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

It depends on what you want to do.

- do you want do display a variable like x=54.124678 but roundet with 3 digits after the decimal point ?
This is the case of both suggested solutions.
Ex. TextBox1.Text=Round(x,3)

- do you want to allocate the value in the TextBox to a variable but rounded ?
Ex. x=Round(TextBox1.Text,3)

- do you want the variable in the Textbox rounded during input ?
This would be somewhat more complicated, but you can use the Door library
and look at agrahams example of Uppercase in textbox or the livefilter example and adpt it to your requirement.
You will find this in:
http://www.basic4ppc.com/forum/questions-windows-mobile/2183-live-type-filtering-list-box.html

Best regards
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #8 (permalink)  
Old 04-25-2008, 05:23 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

YES!
Your exatcly right Klaus.
I want it done at input. ei, TextBox1.Text=TextBox2.Text+TextBox3 ,then have it rounded out.

Ill see what the link will produce.
Reply With Quote
  #9 (permalink)  
Old 04-25-2008, 06:06 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Is it this what you are looking for ?

Best regards
Attached Files
File Type: zip TextRound.zip (4.6 KB, 15 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #10 (permalink)  
Old 04-25-2008, 06:25 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

Thanks Klaus,
That looks like what Im looking for.
Much apreciation to every ones advice.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i change the color of text in textbox? fishworld2006 Questions (Windows Mobile) 1 08-25-2008 04:54 AM
Focus text in textbox! superbabicka Questions (Windows Mobile) 5 04-01-2008 11:48 AM
Formating text in textbox Dr. Feelgood Questions (Windows Mobile) 1 03-06-2008 05:21 AM
Blank textbox.text value Cableguy Questions (Windows Mobile) 5 06-30-2007 08:58 PM
problem with textbox.text multiline Stellaferox Questions (Windows Mobile) 5 06-16-2007 06:54 PM


All times are GMT. The time now is 09:20 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0