Results 1 to 17 of 17

Thread: Vb Urgent Help

Hybrid View

  1. #1

    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.

  2. #2
    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.

  3. #3

    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

  4. #4
    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.

  5. #5

    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