.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 3rd, 2012, 12:11 PM
nightyeye nightyeye is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 4 nightyeye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 13 sec
Reputation Power: 0
Smile Making Pythagoras Theorem App using VB .NET

I just wanna share my apps in this forum and hopping for any feedback to help me improve on my programming skills. I had made an application on "Pythagoras Theorem" so to make it easier for those who having trouble finding the answer for your Pythagoras Theorem questions. Have fun Playing with it..

Things Needed:

6 Labels
3 buttons
2 text boxes


Here are the CODE:

Code:
Function Pythagoras_Theorem(A As Double, B As Double, C As Double) As Double
 
      PythagorasTheorem = A ^ 2 + B ^ 2 = C ^ 2
 
End Function

Private Sub Command1_Click()
Label6 = (Text1.Text ^ 2) + (Text2.Text ^ 2)
Label6.Caption = Val(Label6 / 2)
End Sub

Private Sub Command2_Click()
Form_Load

End Sub

Private Sub Command3_Click()
End

End Sub

Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Label6.Caption = ""

End Sub

Private Sub Label6_Click()

End Sub


Here are the attributes:

Quote:
Begin VB.Form Form1
Caption = "Pythagoras Theorem"
ClientHeight = 2955
ClientLeft = 3360
ClientTop = 2940
ClientWidth = 3840
LinkTopic = "Form1"
ScaleHeight = 2955
ScaleWidth = 3840

Begin VB.CommandButton Command3
Caption = "END"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 10
Top = 1800
Width = 975
End

Begin VB.CommandButton Command2
Caption = "Reset"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 9
Top = 1800
Width = 975
End

Begin VB.CommandButton Command1
Caption = "Calculate"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 8
Top = 1800
Width = 975
End

Begin VB.TextBox Text2
Alignment = 2 'Center
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 1
Top = 600
Width = 375
End

Begin VB.TextBox Text1
Alignment = 2 'Center
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 0
Top = 600
Width = 375
End

Begin VB.Label Label6
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 7
Top = 1200
Width = 1695
End

Begin VB.Label Label5
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "C ="
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 6
Top = 1200
Width = 615
End

Begin VB.Label Label4
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "Pythagoras Theorem"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 5
Top = 120
Width = 2655
End

Begin VB.Label Label3
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "= C^2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2160
TabIndex = 4
Top = 600
Width = 975
End

Begin VB.Label Label2
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "^2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 3
Top = 600
Width = 375
End

Begin VB.Label Label1
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "^2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 2
Top = 600
Width = 375
End

End

Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Reply With Quote
  #2  
Old June 4th, 2012, 12:20 PM
MBirchmeier's Avatar
MBirchmeier MBirchmeier is offline
I <3 ASCII
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Posts: 2,395 MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 18 h 33 m 9 sec
Reputation Power: 1231
Send a message via AIM to MBirchmeier
Quote:
Originally Posted by nightyeye
I just wanna share my apps in this forum and hopping for any feedback to help me improve on my programming skills. I had made an application on "Pythagoras Theorem" so to make it easier for those who having trouble finding the answer for your Pythagoras Theorem questions. Have fun Playing with it..


I don't know how much success you'll have getting code reviews on a site like this, but since I'm waiting for a code review of my own I figured I'd give it a swing:

Quote:
Function Pythagoras_Theorem(A As Double, B As Double, C As Double) As Double

PythagorasTheorem = A ^ 2 + B ^ 2 = C ^ 2

End Function


This function isn't returning anything. Additionally the PythagorasTheorem variable (assuming it's declared elsewhere won't be a 'double' value it will be a boolean. With the equals sign between the B and the C clauses you're effictively asking if they're equal.


[*] Readability will be greatly enhanced if you name your textboxes and buttons instead of text1 perhaps 'inputVariableA'
[*] Remove the empty subs and functions. Unattach any form properties from them if it causes them to not compile.
[*] Consider commenting your functions to aide readability, even if you're just learning. It will help you down the line if you ever come to revisit this. A lot of times when learning something you use it once, then tend to forget about it. If you comment your code you'll be able to pick it up quicker on the bounce.

-MBirchmeier
__________________
My fiancee's transition from accountant to writer
0x4279 7465 204D 6521

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Making Pythagoras Theorem App using VB .NET

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap