vb.net code for automobile loan calculator

vb.net code for automobile loan calculator

Page 1 of 1

2 Replies - 2656 Views - Last Post: 14 September 2009 - 06:42 AM Rate Topic: -----

#1 Anasa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-September 09

vb.net code for automobile loan calculator

Posted 13 September 2009 - 10:22 PM

I have not been able to run the design for this code...it is saying syntax error: Please somebody!



o change this template use Tools | Options | Coding | Edit Standard Headers.
'
Option Explicit On
Option Strict On
Public Partial Class MainForm
	'Declare Constant Credit Rating
	Const dblA As Double = 5.0D
	Const dblB As Double = 5.0D * 1.1
	Const dblC As Double = 5.0D * 1.15
	Const dblD As Double = 5.0D * 1.17
	Const dblE As Double = 5.0D * 1.25
	
	Public Sub New()
		' The Me.InitializeComponent call is required for Windows Forms designer support.
		Me.InitializeComponent()
		
		'
		' TODO : Add constructor code after InitializeComponents
		'
	End Sub
	
	Sub TextBox1TextChanged(ByVal sender As Object, ByVal e As EventArgs)
		Dim dblLoanAmount As Double
		Dim dblCurrentInterestRate As Double
		'the following stores the crdeit rating
		
		lblLoanAmount.Text = Convert. ToString(dblLoanAmount)
		lblCurrentInterestRate.Text = Convert. ToString(dblCurrentInterestRate)
		
	End Sub
		Sub MainFormLoad(ByVal sender As Object, ByVal e As EventArgs)
		
	End Sub
	
	Sub RadACheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
		'determine whether the credit rating is A
		
		
	End Sub
	
	Sub GrpCreditRatingEnter(ByVal sender As Object, ByVal e As EventArgs)
		Sub TextBox3TextChanged(ByVal sender As Object, ByVal e As EventArgs)
		
	End Sub
	
	Sub BtnComputePaymentClick(ByVal sender As Object, ByVal e As EventArgs)
		'Dim CurrentInterestRate As Double
		Dim dblLoanAmount As Double
		Dim dblCurrentInterestRate As Double
		Dim dblCreditRating As Double
		Dim dblComputePayment As Double
		If dblCreditRating = dblA Then
			dblCurrentInterestRate = 5.0
			
			'compute the value for payment
		 dblComputePayment = Convert.TodblLoanAmount * CurrentInterestRate
		 End If
		If dblCreditRating = dblB Then
				dblCurrentInterestRate = 5.0 * 1.1
				If dblCreditRating = dblC Then
					dblCurrentInterestRate = 5.0 * 1.15
					If dblCreditRating = dblD Then
						dblCurrentInterestRate = 5.0*1.17
						If dblCreditRating = dblE Then
							dblCurrentInterestRate = 1.25
						End If
					End If
				End If
			End If
		
	End Sub
	
End Class


Thanks

Mentor Edit: :code:

This post has been edited by AdamSpeight2008: 14 September 2009 - 09:07 AM


Is This A Good Question/Topic? 0
  • +

Replies To: vb.net code for automobile loan calculator

#2 Jay93  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 92
  • Joined: 04-August 09

Re: vb.net code for automobile loan calculator

Posted 13 September 2009 - 11:06 PM

If you are using VB express edition or visual studio, then syntax errors are very easy to find because you just double click the error message and it will take you to the error and tell you whats wrong.
Was This Post Helpful? 0
  • +
  • -

#3 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: vb.net code for automobile loan calculator

Posted 14 September 2009 - 06:42 AM

Several problems in you code.

1) It looks like you coded in the generated code block because it says Partial Public at the top of the Class. You should be coding in the regular code block for the class.

2) You should be using TextBox controls for data entry, not Labels - Labels are for output only.

3) You should not be using TextChanged as an event as it fires on every character added or removed. Useless for your application.

4) BtnComputePaymentClick tries to use the interest rate before it is even assigned.

5) The dblX variables and the comparison is bizarre and meaningless - try a different way of declaring the credit rating. - e.g. maybe input the string "AA" for double A rating and then compare the string to "AA" and then set the interest rate to 5D. Comparing a number to the same number and then setting a third number to the same number is just silly.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1