Important alert: (current site time 7/16/2013 1:31:51 AM EDT)
 

VB icon

[ A program to calculate the area, circumference and diameter of a circle. ]

Email
Submitted on: 8/4/2003 12:56:00 PM
By: JamesJD  
Level: Beginner
User Rating: By 1 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 24555
author picture
(About the author)
 
     This simple little program will calculate the area, circumference and the diameter of a circle. Please leave your comments and votes, thanks :)

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: [ A program to calculate the area, circumference and diameter of a circle. ]
' Description:This simple little program will calculate the area, circumference and the diameter of a circle. Please leave your comments and votes, thanks :)
' By: JamesJD
'
' Inputs:One TextBox, one CommandButton, and three Labels. (You just need to keep their default names).
'
' Returns:The values of a circles area, circumference and diameter.
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=47395&lngWId=1'for details.'**************************************

Private Sub Command1_Click()
If Text1.Text = "" Then
 MsgBox ("Please enter a number in the text box!")
 Text1.SetFocus
Else
 Dim Radius
 Radius = Text1.Text
 Dim Diameter
 Diameter = Val(Radius) + Val(Radius)
 Dim Area
 Area = 3.14159 * (Radius * Radius)
 Dim Circumference
 Circumference = 3.14159 * (Val(Radius) + Val(Radius))
 Label1.Caption = "Diameter: " & Diameter
 Label2.Caption = "Area: " & Area
 Label3.Caption = "Circumference: " & Circumference
 Text1.Text = ""
 Text1.SetFocus
End If
End Sub


Other 21 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
8/4/2003 1:02:51 PMcoder86

Great Code!

(If this comment was disrespectful, please report it.)

 
1/5/2004 8:13:42 AM

100
(If this comment was disrespectful, please report it.)

 
11/16/2004 6:06:12 PM

good code
(If this comment was disrespectful, please report it.)

 
9/14/2005 5:45:15 AMwaheed

what ever i says i can not thank you
(If this comment was disrespectful, please report it.)

 
10/30/2009 7:15:17 AMRajeev Ranjan

Its nice
(If this comment was disrespectful, please report it.)

 
11/24/2009 12:09:25 AMraja

nice coding.
(If this comment was disrespectful, please report it.)

 
11/24/2009 12:11:21 AMraja

good
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.