Results 1 to 17 of 17

Thread: Vb Urgent Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Vb Urgent Help

    hi

    I'm learning vb and completing tutorials to help understanding. however, i am stuck.

    i need help with the following program. i have completed the other tutorials, but not this one as i don't know where to start from. i need to complete this as soon as possible. i am learning visual basic from tutorials but stuck on this particular one.

    An Investment Club meets regularly to review a range of investment opportunities. The club members provide information about the future investment goals, and the how far ahead, in years, to achieve this goal, together with an estimate of the likely return on the investment.

    For each investment the designated club member will provide the following information:

    a. future investment goal, the Future Value (FV)
    b. the term of the investment in years, (Term)
    c. and the estimated yearly interest rate, (Rate).

    For each investment by a designated club member:

    a. compute and display the initial amount (PV) that must be invested to attain the investment goal for each individual investment opportunity.
    b. after the calculation for each individual investment, provide a summary containing:
    • the number of investments
    • the total initial investment amount required for all investments to be displayed.

    A club summary, which should be displayed on a second form and contain:

    • a summary of the total number of investors in the club,
    • the total value of all initial investments,
    • the average initial investment per investor.


    it's basically a calculator to that can carry out the tasks.


    the variables i have got in mind:

    dim interest rate as single
    dim investment as single
    future investment goal

    please can you help me solve this. please start me of so that i know how you are doing this.

    this is what i am thinking of

    This is what i have thought of

    Private fInitialInv As Currency ‘Initial investment amount
    Private fnumInv As Integer ‘Number of investors
    Private fTotalInitInv As Currency ‘Total of all initial investments

    Purpose

    this program computes the initial investment for individual club members
    and for the club as a whole given the future goal, annual interest rate, and term in years,
    the initial investment will be found and displayed. additionally, for multiple investment
    by a single investor, the number of investments and their total value are computed and displayed.
    finally, the number of investors, their total and average initial investment are displayed on a summary form.

    Input

    FV
    Term (calculate by PV)
    Rate

    Output

    Number of investments (+1)
    Total investment (TInvestments + PV)

    Summary
    NInvestors = NInvestors +1
    TInvestors = TInvestors + Investments

    Average = TInvestors
    __________
    NInvestors

    I have thought on the following buttons for the program, but not sure:

    Calculate
    Add to portfolio
    Clear inputs
    Add to club
    New investor
    Club summary
    Exit


    Investor name , text box to enter details
    Investment goal, text box to enter details
    Term in years, text box to enter details
    GrowthRate%, text box to enter details

    please help as it is urgent

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb Urgent Help

    Welcome to the forums.

    Its sounds as though you have a good start.

    What is your specific question? Are you having a problem with a formula?

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Re: Vb Urgent Help

    Thankyou

    My question is the cording, i don't no where to start from

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb Urgent Help

    Well, I'm a little confused by you answer.

    Based on your first post, you seem to know exactly what needs to be done.

    If you were doing this on paper, how would you write the calculation(s)?

  5. #5
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Re: Vb Urgent Help

    Hack can kind of see the question.

    You need a form that allows the member to enter the FV target, the term of the investment, and the Rate of Interest. I think then maybe a button that has some code behind it to calculate the required PV needed to reach the FV taking into account the term (timeframe?) of the investment, and the expected rate of Interest per month/year/week.

    After the calculation then the PV would be displayed.

    Hope that clarifies somewhat.

  6. #6
    Junior Member Thunder!'s Avatar
    Join Date
    Feb 2008
    Posts
    22

    Re: Vb Urgent Help

    hello it seems to be a spreadsheet question, although I can see the advantage of coding the project in vb. Is it a uni question or required in order to make a real decision?

  7. #7
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Re: Vb Urgent Help

    Quote Originally Posted by Thunder!
    hello it seems to be a spreadsheet question, although I can see the advantage of coding the project in vb. Is it a uni question or required in order to make a real decision?
    I'm learning vb and completing tutorials to help understanding.
    Would appear to be a tutorial project from a learning course.

  8. #8
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Vb Urgent Help

    If you have the formula, post it!

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Re: Vb Urgent Help

    Hi

    its a tutorial taken from text book

  10. #10

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Re: Vb Urgent Help

    I'm Having Problems With Formula. I Know I Have Got A Good Start, I Know What Buttons To Create.

    But How Do I Start Writing The Code

  11. #11
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb Urgent Help

    Well, start with creating the buttons then put the code in the buttons click event.

  12. #12

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Re: Vb Urgent Help

    This is the problem, i can't write the code. i'm finding it difficult. i've set up the buttons:

    calculate
    clear inputs
    add to club
    add to portfolio
    new investor
    club summary
    exit

    i can do the code for the clear inputs and exit, but not for the rest
    i will be grateful if you can start me of.

  13. #13
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb Urgent Help

    Do me a favor and answer the following questions.

    This is what you posted in your first post:

    a. compute and display the initial amount (PV) that must be invested to attain the investment goal for each individual investment opportunity.
    b. after the calculation for each individual investment, provide a summary containing:
    • the number of investments
    • the total initial investment amount required for all investments to be displayed.

    Do you know how to do the calculation for this on paper?

    If so, how would you do it?

  14. #14
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Re: Vb Urgent Help

    Quote Originally Posted by zobi316
    This is the problem, i can't write the code. i'm finding it difficult. i've set up the buttons:

    calculate
    clear inputs
    add to club
    add to portfolio
    new investor
    club summary
    exit

    i can do the code for the clear inputs and exit, but not for the rest
    i will be grateful if you can start me of.
    zob this is fairly straight forward stuff, surely the book you are doing the tutorial from has discussed vb coding conventions, how to use textbox values etc?

    Soirry have no idea on the formula though a quick google will probably give it to you.

  15. #15

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Re: Vb Urgent Help

    Thankyou for the tips. it was very useful.

    i have almost completed the program. but stuck on the add to club buton. can't get that functioning.

    how do i do this

  16. #16
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Re: Vb Urgent Help

    Quote Originally Posted by zobi316
    Thankyou for the tips. it was very useful.

    i have almost completed the program. but stuck on the add to club buton. can't get that functioning.

    how do i do this
    Could you post the current code behind the button, and also explain in detail what you are trying to achieve.

  17. #17

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    8

    Re: Vb Urgent Help

    this is the code. its not adding to the club, it is in one way but the amount is zero. i can't also set my amount to currncy. please have a look, if this sounds confusing have a look at the attachment of my program, you will understand it.

    Option Explicit

    Public PV As Double
    Public FV As Double
    Public i As Double
    Public n As Double
    Public Initial As Double
    Public Investments As Double
    Public Investors As Integer

    Private Sub cmdCalculate_Click()
    txtInitialInvestment.Text = Val(txtInvestmentgoal.Text) / ((Val(((txtGrowthrate.Text) / 100) + 1) ^ txtTermyears.Text))

    End Sub

    Private Sub cmdClear_Click()
    txtName.Text = ""
    txtInvestmentgoal.Text = ""
    txtTermyears.Text = ""
    txtGrowthrate.Text = ""
    txtInitialInvestment.Text = ""

    txtName.SetFocus
    End Sub

    Private Sub cmdExit_Click()
    Dim ans As Integer
    ans = MsgBox("Are you sure you want to quit?", vbYesNo + vbQuestion, "quit") 'This is the message to be displayed once clicked on exit
    If ans = vbYes Then
    End
    End If
    End Sub

    Private Sub cmdportfolio_Click()
    Initial = Initial + PV
    Investments = Investments + 1
    txtNoinvestors.Text = Investments
    txtInitial.Text = Format(Initial, "Currency")
    cmdNewinvester.Visible = True
    cmdAddtoclub.Visible = True
    cmdportfolio.Visible = False
    lblNoinvestors.Visible = True
    txtNoinvestors.Visible = True
    lblInitial.Visible = True
    txtInitial.Visible = True
    txtInvestmentgoal.Text = ""
    txtGrowthrate.Text = ""
    txtTermyears.Text = ""
    txtInitialInvestment.Text = ""
    txtInvestmentgoal.SetFocus

    End Sub

    Private Sub cmdSummary_Click()
    ' Purpose: When the Display Second Form button is clicked,
    ' the second form becomes visible.
    frmSummary.Show
    End Sub

    ' Purpose: When the Display Second Form button is clicked,
    ' the second form becomes visible.
    Private Sub cmdShowSummary_Click()
    frmSummary.Show
    End Sub

    ' Purpose: When the user closes this form, the second form is also
    ' unloaded from memory, thus ending the application
    Private Sub Form_Unload(Cancel As Integer)
    Unload frmSummary
    End Sub
    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width