# Help needed on Visual basics 2005



## attoe123 (Nov 25, 2008)

hi all 

ive been set an assignment at uni to create the following application 

Create an application to simulate a small “repayments calculator” .
The application should allow the customer to enter the following details:

•	price of the car
•	down-payment
•	current annual interest rate offered



The application should then display the following in a tabular form:

•	loans duration in months
•	monthly repayments for 2, 3, 4, and 5 year loans
•	total cost of loans

The variety of options should allow the user to easily compare repayment plans and choose the one that most suits their requirements.

The application must perform input data validation to check that the specified 
down-payment is a minimum of 10%. 


ive created the GUI but have no idea how to create the code for such a program can someone hlep me please 

nathan


----------



## FordGT90Concept (Nov 25, 2008)

Could you be more specific on what you need help with?


----------



## Steevo (Nov 25, 2008)

attoe123 said:


> hi all
> 
> ive been set an assignment at uni to create the following application
> 
> ...





How about we provide the code if you give us your teachers e-mail?


----------



## sno.lcn (Nov 25, 2008)

What do you not know how to do?  Do you need the code for all of it?


*Edit:  How does your teacher feel about getting help?  And how much are you allowed to get?


----------



## Sasqui (Nov 25, 2008)

"Give a man code, and he can pass a class.  Teach a man..." oh, nevermind,


----------



## sno.lcn (Nov 25, 2008)

Not when exam time comes


----------



## attoe123 (Nov 25, 2008)

hey all 

being more specific

ive got to create a car loans calculator attached is the GUI which i have created as you will see it only a basic calulator the thing that i am stuck on is the code,

im not sure how i can get the program to calculate the loan amount minus the down payment and work out the intrest rate. and then display the information in the text box at the bottom in the follwoing format

loan duration (YEARS)    Monthly repayments       total cost (inc.intrest)
2
3
4
5

the loan amount, intrest rate and down payment the user types in 

im not looking for the code to be written for me im looking for guidence and help with me writting the code myself 

ive not being doing programming for long and ive not very confident at to behonest a little confused about making the code i willing to learn i just need help


----------



## Steevo (Nov 25, 2008)

Create somethign in excel and use VB in there.


----------



## attoe123 (Nov 25, 2008)

Steevo said:


> Create somethign in excel and use VB in there.



i have to use vb software to create all theprogram


----------



## FordGT90Concept (Nov 25, 2008)

I expect you have some understanding of algebra, correct?  You know, 1 + 2 = x therefore x = 3...

I also expect you to know how to turn that equation into a VB statement:

```
Dim x As Integer = 1 + 2
```

And because you'll be dealing with decimal numbers instead, we revise it like so:

```
Dim x As Double = 1.0 + 2.0
```

You can retrieve text from a TextBox and convert it to a decimal like so...

```
Dim x As Double = Conver.ToDouble(myTextBox.Text)
```

Now that we have know we have the fundamentals down...

Just expand upon it.


----------



## attoe123 (Nov 25, 2008)

FordGT90Concept said:


> I expect you have some understanding of algebra, correct?  You know, 1 + 2 = x therefore x = 3...
> 
> I also expect you to know how to turn that equation into a VB statement:
> 
> ...



how do i get the answerto display in the text box
ive been told all the code will go in the calulate button is that correct?


----------



## Deleted member 3 (Nov 25, 2008)

attoe123 said:


> how do i get the answerto display in the text box
> ive been told all the code will go in the calulate button is that correct?



myTextBox.text = 1 + 2

it would fill the textbox with 3. Don't they teach you the basics in class?


----------



## attoe123 (Nov 25, 2008)

im really confused ive not beeen learning for long


----------



## FordGT90Concept (Nov 25, 2008)

attoe123 said:


> how do i get the answerto display in the text box
> ive been told all the code will go in the calulate button is that correct?


Or if it is already in a variable...

```
Dim x As Double = 1.0 + 2.0
myTextBox.Text = x.ToString()
```


----------



## Deleted member 3 (Nov 25, 2008)

FordGT90Concept said:


> Or if it is already in a variable...
> 
> ```
> Dim x As Double = 1.0 + 2.0
> ...



Why the tostring()? It works fine without. Are there any examples in which it would go wrong otherwise? ie am I writing dirty code?


----------



## attoe123 (Nov 25, 2008)

its staying my text box cant be defined as double y


----------



## FordGT90Concept (Nov 26, 2008)

DanTheBanjoman said:


> Why the tostring()? It works fine without. Are there any examples in which it would go wrong otherwise? ie am I writing dirty code?


"string = object" defaults to "string = object.ToString()"

Basically not to have it is to be lazy. 

I include it because it forces the type of string to be used.  It's not vital in this scenario because Control.Text is explicitly declared a string but it would be, for instance, in assigning data to the Control.Tag property which is explicitly defined as an object.  Instead of Control.Tag being of type string, as intended, it would be of type double.  So at some point, it would still have to invoke the object.ToString() method.




attoe123 said:


> its staying my text box cant be defined as double y


Could you copy the line that is throwing that exception and any relevant information?


----------

