Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting started with VB.net

Posted on 2004-10-26
6
Medium Priority
?
198 Views
Last Modified: 2010-04-24
I am trying to teach myself VB.net, and I thought I would try to create a mortgage calculator.  How would I get started in VB.net using VisualStudio.net to create a mortgate calculator that has the functionality as shown in this image.

http://www.stevetout.com/calculator.gif
0
Comment
Question by:gmahler5th
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Expert Comment

by:AmanBrar
ID: 12418629
Hi,

First you would need to design the application by placing four textboxes and using Properties window set their Names as:
txtPrincipal  for Principal Balance
txtRate        for Interest Rate
txtYears      for Number of years
txtAmount   for Payment Amount

and a Button:
btnCalculate   for Calculating

then in the .vb file you need to add the following calculation code:

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        txtAmount.Text = txtPrincipal.Text + (CDbl(txtPrincipal.Text) * CDbl(txtRate.Text) * CDbl(txtYears.Text)) / 100.0
End Sub

hope this helps.
0
 

Author Comment

by:gmahler5th
ID: 12418671
I've added all of the textboxes and a button.  This is the code in the form on the code view.  I'm not sure I understand what's going on, where to declare my variables.

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

    End Sub
End Class
0
 
LVL 2

Accepted Solution

by:
AmanBrar earned 2000 total points
ID: 12418779
Hi,
if you want to use variables, try using this:

p.s. - if you want the Payment Amount as the total amount of Principal+Interest, then do this:

Public Class Form1
    Inherits System.Windows.Forms.Form

    'declare your variables here
    Dim dblPrincipal, dblRate, dblYears, dblAmount As Double
   
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

        'assign the values from textboxes to the variables
        dblPrincipal = CDbl(txtPrincipal.Text)
        dblRate = CDbl(txtRate.Text)
        dblYears = CDbl(txtYears.Text)

        'calculate the final amount as principal + interest
        dblAmount = dblPrincipal + (dblPrincipal *  dblRate *  dblYears) / 100.0

        'put the calculated amount in Payment Amount textbox
        txtAmount.Text = dblAmount.ToString
    End Sub
End Class


p.s. - If your Payment Amount is just the calculated Interest, then use this:

Public Class Form1
    Inherits System.Windows.Forms.Form

    'declare your variables here
    Dim dblPrincipal, dblRate, dblYears, dblAmount As Double

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

        'assign the values from textboxes to the variables
        dblPrincipal = CDbl(txtPrincipal.Text)
        dblRate = CDbl(txtRate.Text)
        dblYears = CDbl(txtYears.Text)

        'calculate the amount of interest
        dblAmount = (dblPrincipal * dblRate * dblYears) / 100.0

        'put the calculated amount in Payment Amount textbox
        txtAmount.Text = dblAmount.ToString
    End Sub
End Class
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Expert Comment

by:armoghan
ID: 12419902
gmahler5th ...
You didnt paste the whole code
all your designer code is present in
"Windows Form Designer generated code" region. See the soruce code and click the + sign to expand and see teh code in it
0
 
LVL 27

Expert Comment

by:planocz
ID: 12420649
Hi,

Here is where I found good examples for getting started in VB.Net

.....http://msdn.microsoft.com/vbasic/downloads/samples/101samples.aspx

Link for ASP programs...

http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx 
0
 

Author Comment

by:gmahler5th
ID: 12470125
I just used tried your code and I got some debug errors.  They are visible in this image:

http://www.stevetout.com/debug-error.jpg

Any thoughts on how I could fix these errors?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question