Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
square rooting in VB
#1
Hey,
can anyone tell me how to square root stuff inside a text box,cant seem to find out.
Reply
#2
it's basicly this
Code:
Text1.Text = Sqr(Text1.Text)
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#3
not quite. i tried that and it didn't work for me. use this formula.
Code:
Num = val(text1.text)
Answer = Num^.5
easy...
the mind is a beautiful thing, use it and make the world a more beautiful place.
Reply
#4
Quote:it's basicly this
Code:
Text1.Text = Sqr(Text1.Text)
you just gotta do this:
Code:
Text1.Text = Str(SQR(Val(Text1.Text)))
B 4 EVER
Reply
#5
it worked on mine without turning it into a string and back
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#6
Quote:...use this formula.
Code:
Num = val(text1.text)
Answer = Num^.5
Mech, that's brilliant! I never thought you could raise a number to .5 to get the square root. I wrote a little program to test it.

Who said you can't teach an old dog new tricks.
Thanks!
*****
Reply
#7
Well, that's just math. The Nth root of a number is that number powered to the 1/Nth power.

[Image: img17.png]
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#8
*Zack runs in to give his useless two cents*
-(n^-1) is the negative reciprocal of a number.
Whatever. :roll:
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#9
Quote:it worked on mine without turning it into a string and back

VB has a "VARIANT" default. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#10
Quote:Well, that's just math. The Nth root of a number is that number powered to the 1/Nth power.

[Image: img17.png]


To be exactly....

nSQR is the n-th root of a number.

Code:
nSQR(x ^ p) = x ^ (p/n)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)