1 Replies - 251 Views - Last Post: 07 August 2012 - 12:01 PM Rate Topic: -----

#1 tashunca  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-August 12

I keep getting 9 decimal places in my text box Answer, I need only 3

Posted 06 August 2012 - 09:43 PM

Private Sub cmdCalculate_Click()

If txtIFV * txtICV <> 0 Then X = 1 / (6.28 * txtIFV * txtICV)

If txtIRV * txtICV <> 0 Then Let X = 1 / (6.28 * txtIRV * txtICV)

If txtICV = 0 Then Let txtC = 1 / (6.28 * txtIFV * txtIRV * Tan(txtD + 1.57))

If txtIFV = 0 Then Let txtF = 1 / (6.28 * txtICV * txtIRV * Tan(txtD + 1.57))

If txtIRV = 0 Then Let txtR = X / Tan(txtD + 1.57)


ModEdit:- Happens in above line

Let D = -Abs(D / 57.3)

If txtD = 0 Then Let txtPA = Atn(X / txtIRV) - 1.57   

txtCVL = txtD * 57.3

txtRVL = txtD * 57.3 + 90


1. I tried txtR.Text = Format(txtR.Text,"#000.00")
2. txtR.Text As Double = 0.000)
3. txtR.Text = (txtR.Text / 100).ToString("N2") please hlp.

This post has been edited by AdamSpeight2008: 07 August 2012 - 01:55 PM


Is This A Good Question/Topic? 0
  • +

Replies To: I keep getting 9 decimal places in my text box Answer, I need only 3

#2 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 18
  • View blog
  • Posts: 255
  • Joined: 21-May 09

Re: I keep getting 9 decimal places in my text box Answer, I need only 3

Posted 07 August 2012 - 12:01 PM

first: place your code inside code tags for easier read.
second: seems like 6.28 is a constant, declare it as such it could help a bit.
third: you can convert the result to string and take the first 5 chars from the beggining of the string (the last thing you mentioned you tried is not how you convert numbers to strings)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1