Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Not wanting to round...


Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2003, 07:06 PM
rpgreligion rpgreligion is offline
Regular
 
Join Date: Feb 2003
Location: In front of the comp..duh
Posts: 88
Default Not wanting to round...


Code:
Dim area As Long Private Sub Command1_Click() If Combo1.ListIndex = 1 Then pi = Val(3.141592654) d = Val(Label2.Caption / 2) area = Val(pi) * Val(d ^ 2) MsgBox "The Area is " & area, , "Area" End If If Combo1.ListIndex = 2 Then pi = Val(3.14) d = Val(Label2.Caption / 2) area = Val(pi) * Val(d ^ 2) MsgBox "The Area is " & area, , "Area" End If If Combo1.ListIndex = 3 Then pi = Val(22 / 7) d = Val(Label2.Caption / 2) area = Val(pi) * Val(d ^ 2) MsgBox "The Area is " & area, , "Area" End If End Sub

I want the answer (area) to show the decimal places. But every time i plug in a number, it rounds it to the nearest whole number. How can I prevent this, and make it go to the decimals?
__________________
The biggest mistake in programming is impatience
Reply With Quote
  #2  
Old 03-28-2003, 07:10 PM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,688
Default

Dim dArea as Double

Long cannot accomodate decimals.
Reply With Quote
  #3  
Old 03-28-2003, 07:12 PM
rpgreligion rpgreligion is offline
Regular
 
Join Date: Feb 2003
Location: In front of the comp..duh
Posts: 88
Default

ah....thx.
__________________
The biggest mistake in programming is impatience
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Round Function for VB5? Infector General 1 02-01-2003 02:15 AM
If Then Tabbing Guidelines KicKs General 11 08-25-2002 06:58 PM
Round a number to 2 places after decimal extreme General 2 06-26-2002 12:29 AM
Round Function FunctionMan General 2 05-14-2002 02:38 PM
Yoderic's Battle Arena -- Come And Play!! JDYoder Game Programming 4 12-11-2001 09:59 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->