Solved

Need help writing a VB.net program about expenses

Posted on 2007-04-02
9
503 Views
Last Modified: 2012-05-05
I need to write a program in VisualBasic.net that allows a user to input costs for items and choose the category that the item belongs in.  At the end, I want to be able to have the computer add all of the costs up by category and display it.  Can anyone help me with this?  
0
Comment
Question by:joleos
  • 3
  • 3
  • 3
9 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18840662
"Help" you with it?...or do the whole thing?

Is this a WebForms or WinForms project?

What version VB.NET?   2005?   2003 (or below)?

How do you want to store this data?  Stock Collection Classes (Arrays, ArrayLists)?  Custom Classes?  In memory DataSet?  Some kind of backend database?

The simplicity of the project somewhat "smells of homework".     =\

Apologies if I am mistaken...
0
 
LVL 1

Expert Comment

by:cmwhite
ID: 18844361
Ill give you a hint for your homework, if you ask a specific question I might help more but I will not do the work for you. Your answer lies most easily in ListBox controls, TextBox Controls, a Add Button, A dropdown box, and a Calculate button. Using those you should be able to do the GUI support for your program. A simple foreach statement for calculation's can accomplish what you want for your support. From your description it does sound like homework like Idle_Mind said, but it doesnt sound like you want a database backend, collection classes wont be useful since you want to Manage the info which a listbox with details view can accomplish.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18844486
If it is homework, often times the students do things completely from the Console...the user types in the values one by one...so a GUI might not even be used.   =\

For example:

        Dim category As String
        Console.Write("Enter a Category: ")
        category = Console.ReadLine()

Feedback from joleos would be nice...
0
 

Author Comment

by:joleos
ID: 18845724
Yes, this is homework. . . and no, I did not want anyone to do it for me.  I have been working through this course to the best of my ability and understand most of the logic of vb.net, but when it comes to figuring out the best way to put things together I have a hard time.  This is an online course I'm taking, so there hasn't been alot of explanation on things and we were required to pick a project the first week of class before we knew anything about programming.  Well, we've been through 13 weeks of class and there still isn't explanations of how to do alot of things. . . thus, the reason I'm asking for help.  This is on VB 2003 and would be a Windows Application.  The hints you have given are helpful in giving me an idea of the best way to set it up, so I will try to start in that manner.  I do appreciate the help, but I don't appreciate the sarcasm for asking for help.  
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:cmwhite
ID: 18845879
No sarcasm intended. I have been doing online troubleshooting/helpdesk for years now on chat networks and everyone seemed to always want you to do something for them. I in no way intended for you to do that, But I believe you will find your answer in what I have given you. Any further questions I will help you with.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18846051
Just working "around" EE policies:
http://www.experts-exchange.com/help.jsp#hi105

There are sooooo many ways to go about this task.  Thus all my questions!  Without any guidelines we have no idea what YOU have envisioned..

Do you want the user to pick a category from a static, predefined list?...or is everything dynamic?

You could use a TreeView to show the items in a hierarchical view.  You could have several textboxes to enter the category, item name and cost.

Or you could use a ListView with multiple columns.

You could use a DataGrid for the data entry.

Do you want a seperate form to enter new items etc.

Are there any requirements that you must meet?  Data must be stored in a custom class or you must use an ArrayList etc...
0
 

Author Comment

by:joleos
ID: 18864440
Here is what I have so far.  I’m sure I’m doing everything the LONG way, and probably the wrong way, but I don’t know how else to do it.  We have not done anything with datagrids, treeviews, and much more.  What I thought this was supposed to do was to show a form with boxes within it and show each category with each month below it and allow the user to input the $ for each month.  After they enter all of the $, I want them to be able to click on a Calculate button.  At this point, I want another message box to appear with each category and the total for the year for each, and a grand total for the year.  (I haven’t gotten that far yet, unsure of what to do next.)  Can you guide me along some more and help me with what I am missing or need to do next?  Thanks for the help.

Public Class FrmLogicalOperator
    Inherits System.Windows.Forms.Form

    Private Sub FrmLogicalOperator_Load( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load

        Dim janhouse, febhouse, marhouse, aprhouse, mayhouse, junhouse, julhouse, aughouse, sephouse, octhouse, novhouse, dechouse As Decimal
        Dim jancar, febcar, marcar, aprcar, maycar, juncar, julcar, augcar, sepcar, octcar, novcar, deccar As Decimal
        Dim janhi, febhi, marhi, aprhi, mayhi, junhi, julhi, aughi, sephi, octhi, novhi, dechi As Decimal
        Dim janci, febci, marci, aprci, mayci, junci, julci, augci, sepci, octci, novci, decci As Decimal
        Dim janfood, febfood, marfood, aprfood, mayfood, junfood, julfood, augfood, sepfood, octfood, novfood, decfood As Decimal
        Dim janeo, febeo, mareo, apreo, mayeo, juneo, juleo, augeo, sepeo, octeo, noveo, deceo As Decimal
        Dim janelec, febelec, marelec, aprelec, mayelec, junelec, julelec, augelec, sepelec, octelec, novelec, decelec As Decimal
        Dim jancargas, febcargas, marcargas, aprcargas, maycargas, juncargas, julcargas, augcargas, sepcargas, octcargas, novcargas, deccargas As Decimal
        Dim janchild, febchild, marchild, aprchild, maychild, junchild, julchild, augchild, sepchild, octchild, novchild, decchild As Decimal
        Dim janspending, febspending, marspending, aprspending, mayspending, junspending, julspending, augspending, sepspending, octspending, novspending, decspending As Decimal
        Dim lblAndAlso As FrmLogicalOperator
        Dim sumOfHousePayment As Decimal = 0
        Dim sumOfCarPayment As Decimal = 0
        Dim sumOfHouseInsurance As Decimal = 0
        Dim sumOfCarInsurance As Decimal = 0
        Dim sumOfGroceries As Decimal = 0
        Dim sumOfEatingOut As Decimal = 0
        Dim sumOfElectricity As Decimal = 0
        Dim sumOfCarGas As Decimal = 0
        Dim sumOfChildcare As Decimal = 0
        Dim sumOfSpending As Decimal = 0
        Dim year As Integer
        Dim totalexpensesforyear As Decimal = 0

        sumOfHousePayment = janhouse + febhouse + marhouse + aprhouse + mayhouse + junhouse + julhouse + aughouse + sephouse + octhouse + novhouse + dechouse
        sumOfCarPayment = jancar + febcar + marcar + aprcar + maycar + juncar + julcar + augcar + sepcar + octcar + novcar + deccar
        sumOfHouseInsurance = janhi + febhi + marhi + aprhi + mayhi + junhi + julhi + aughi + sephi + octhi + novhi + dechi
        sumOfCarInsurance = janci + febci + marci + aprci + mayci + junci + julci + augci + sepci + octci + novci + decci
        sumOfGroceries = janfood + febfood + marfood + aprfood + mayfood + junfood + julfood + augfood + sepfood + octfood + novfood + decfood
        sumOfEatingOut = janeo + febeo + mareo + apreo + mayeo + juneo + juleo + augeo + sepeo + octeo + noveo + deceo
        sumOfElectricity = janelec + febelec + marelec + aprelec + mayelec + junelec + julelec + augelec + sepelec + octelec + novelec + decelec
        sumOfCarGas = jancargas + febcargas + marcargas + aprcargas + maycargas + juncargas + julcargas + augcargas + sepcargas + octcargas + novcargas + deccargas
        sumOfChildcare = janchild + febchild + marchild + aprchild + maychild + junchild + julchild + augchild + sepchild + octchild + novchild + decchild
        sumOfSpending = janspending + febspending + marspending + aprspending + mayspending + junspending + julspending + augspending + sepspending + octspending + novspending + decspending

        Console.WriteLine("Enter the Year, or -1 to quit: ")
        year = Console.ReadLine()

        While year <> -1


            lblAndAlso.Text = "Mortgage/Rent" & vbCrLf & vbCrLf & _
                "January: " & (janhouse) & _
                "February: " & (febhouse) & _
                "March: " & (marhouse) & _
                "April: " & (aprhouse) & _
                "May: " & (mayhouse) & _
                "June: " & (junhouse) & _
                "July: " & (julhouse) & _
                "August: " & (aughouse) & _
                "September: " & (sephouse) & _
                "October: " & (octhouse) & _
                "November: " & (novhouse) & _
                "December: " & (dechouse) & _
                "Total Mortgage/Rent Expenses is " & (sumOfHousePayment)

            lblAndAlso.Text = "Car Payment" & vbCrLf & vbCrLf & _
                "January: " & (jancar) & _
                "February: " & (febcar) & _
                "March: " & (marcar) & _
                "April: " & (aprcar) & _
                "May: " & (maycar) & _
                "June: " & (juncar) & _
                "July: " & (julcar) & _
                "August: " & (augcar) & _
                "September: " & (sepcar) & _
                "October: " & (octcar) & _
                "November: " & (novcar) & _
                "December: " & (deccar) & _
                "Total Car Payment Expense is " & (sumOfCarPayment)

            lblAndAlso.Text = "House Insurance" & vbCrLf & vbCrLf & _
                "January: " & (janhi) & _
                "February: " & (febhi) & _
                "March: " & (marhi) & _
                "April: " & (aprhi) & _
                "May: " & (mayhi) & _
                "June: " & (junhi) & _
                "July: " & (julhi) & _
                "August: " & (aughi) & _
                "September: " & (sephi) & _
                "October: " & (octhi) & _
                "November: " & (novhi) & _
                "December: " & (dechi) & _
                "Total House Insurance Expense is " & (sumOfHouseInsurance)

            lblAndAlso.Text = "Car Insurance" & vbCrLf & vbCrLf & _
                "January: " & (janci) & _
                "February: " & (febci) & _
                "March: " & (marci) & _
                "April: " & (aprci) & _
                "May: " & (mayci) & _
                "June: " & (junci) & _
                "July: " & (julci) & _
                "August: " & (augci) & _
                "September: " & (sepci) & _
                "October: " & (octci) & _
                "November: " & (novci) & _
                "December: " & (decci) & _
                "Total Car Insurance Expense is " & (sumOfCarInsurance)

            lblAndAlso.Text = "Groceries" & vbCrLf & vbCrLf & _
                "January: " & (janfood) & _
                "February: " & (febfood) & _
                "March: " & (marfood) & _
                "April: " & (aprfood) & _
                "May: " & (mayfood) & _
                "June: " & (junfood) & _
                "July: " & (julfood) & _
                "August: " & (augfood) & _
                "September: " & (sepfood) & _
                "October: " & (octfood) & _
                "November: " & (novfood) & _
                "December: " & (decfood) & _
                "Total Groceries Expense is " & (sumOfGroceries)

            lblAndAlso.Text = "Eating Out" & vbCrLf & vbCrLf & _
                "January: " & (janeo) & _
                "February: " & (febeo) & _
                "March: " & (mareo) & _
                "April: " & (apreo) & _
                "May: " & (mayeo) & _
                "June: " & (juneo) & _
                "July: " & (juleo) & _
                "August: " & (augeo) & _
                "September: " & (sepeo) & _
                "October: " & (octeo) & _
                "November: " & (noveo) & _
                "December: " & (deceo) & _
                "Total Eating Out Expense is " & (sumOfEatingOut)

            lblAndAlso.Text = "Electricity" & vbCrLf & vbCrLf & _
                "January: " & (janelec) & _
                "February: " & (febelec) & _
                "March: " & (marelec) & _
                "April: " & (aprelec) & _
                "May: " & (mayelec) & _
                "June: " & (junelec) & _
                "July: " & (julelec) & _
                "August: " & (augelec) & _
                "September: " & (sepelec) & _
                "October: " & (octelec) & _
                "November: " & (novelec) & _
                "December: " & (decelec) & _
                "Total Electricity Expense is " & (sumOfElectricity)

            lblAndAlso.Text = "Car Gas" & vbCrLf & vbCrLf & _
                "January: " & (jancargas) & _
                "February: " & (febcargas) & _
                "March: " & (marcargas) & _
                "April: " & (aprcargas) & _
                "May: " & (maycargas) & _
                "June: " & (juncargas) & _
                "July: " & (julcargas) & _
                "August: " & (augcargas) & _
                "September: " & (sepcargas) & _
                "October: " & (octcargas) & _
                "November: " & (novcargas) & _
                "December: " & (deccargas) & _
                "Total Car Gas Expense is " & (sumOfCarGas)

            lblAndAlso.Text = "Childcare" & vbCrLf & vbCrLf & _
                "January: " & (janchild) & _
                "February: " & (febchild) & _
                "March: " & (marchild) & _
                "April: " & (aprchild) & _
                "May: " & (maychild) & _
                "June: " & (junchild) & _
                "July: " & (julchild) & _
                "August: " & (augchild) & _
                "September: " & (sepchild) & _
                "October: " & (octchild) & _
                "November: " & (novchild) & _
                "December: " & (decchild) & _
                "Total Childcare Expense is " & (sumOfChildcare)

            lblAndAlso.Text = "Spending" & vbCrLf & vbCrLf & _
                "January: " & (janspending) & _
                "February: " & (febspending) & _
                "March: " & (marspending) & _
                "April: " & (aprspending) & _
                "May: " & (mayspending) & _
                "June: " & (junspending) & _
                "July: " & (julspending) & _
                "August: " & (augspending) & _
                "September: " & (sepspending) & _
                "October: " & (octspending) & _
                "November: " & (novspending) & _
                "December: " & (decspending) & _
                "Total Spending Expense is " & (sumOfSpending)

            Console.WriteLine("Enter the Year, or -1 to quit: ")
            year = Console.ReadLine()

        End While

    End Sub


End Class
0
 
LVL 1

Accepted Solution

by:
cmwhite earned 500 total points
ID: 18865834
Ok.. Here is code that actually works.. what I want you to do is study what I did I have heavily commented it for a learning experience. You can use this code for your homework, but I garuntee your teacher will know that you didnt do it. This is so you can learn several things. Ordering by process in a project, what do I do to get here, to get there.. learning how to step with your program. Also you were mixing a console application with a windows form's application that just doesnt work. This also gives you a basic look at using some of the controls for windows forms such as textboxes, buttons and combo boxes. The textbox control needs to be set to Multiline = true and scrollbars turned to Vertical to get the result I got with my code. Good luck to you and this does exactly what you want. I know I said I wouldnt do it for you, but I think actually studying how I did this you might actually learn something. I appreciate that you tried first, but please take the time to review this.

Also there is no error handling, why dont you add error handling to it to learn about that?
IE: If you click add with nothing selected in either combobox or nothing in the amount box the program will break, how do you fix it?

Learn about MessageBox.Show to interact with your user with windows forms.
Also InputBox exists for  retrieving information.




Imports Microsoft.VisualBasic
Imports System

Public Class FrmLogicalOperator
    Inherits System.Windows.Forms.Form
    ' Dim these as array's. Array's are Zero based so 0 = 1, 1 = 2nd element etc.. so 0-11 = 12 elements.
    ' 12 Months in the year...
    ' We want the whole class to be able to use these.
    Public house(11) As Decimal
    Public car(11) As Decimal
    Public hi(11) As Decimal
    Public ci(11) As Decimal
    Public food(11) As Decimal
    Public eo(11) As Decimal
    Public elec(11) As Decimal
    Public cargas(11) As Decimal
    Public child(11) As Decimal
    Public spending(11) As Decimal

    Public Sub New()
        InitializeComponent()
    End Sub
    Private Sub Calculate()

        ' Now we calculate everything and print it out in a
        ' textbox in the end.

        ' Our generic loop iterator
        Dim d As Decimal = 0

        ' Our totals
        Dim sumOfHousePayment As Decimal = 0
        Dim sumOfCarPayment As Decimal = 0
        Dim sumOfHouseInsurance As Decimal = 0
        Dim sumOfCarInsurance As Decimal = 0
        Dim sumOfGroceries As Decimal = 0
        Dim sumOfEatingOut As Decimal = 0
        Dim sumOfElectricity As Decimal = 0
        Dim sumOfCarGas As Decimal = 0
        Dim sumOfChildcare As Decimal = 0
        Dim sumOfSpending As Decimal = 0

        ' Pass the array variables to the function to generate
        ' our monthly string and store it in a variable
        ' we will output it later
        Dim housestr As String
        housestr = "House Payment" & vbCrLf & vbCrLf & ReturnMonthlyStringCalc(house)

        ' Add up each payment made for the year
        ' and store it in a variable.
        For Each d In house
            sumOfHousePayment = sumOfHousePayment + d
        Next

        Dim carstr As String
        carstr = vbCrLf & "Car Payment" & vbCrLf & ReturnMonthlyStringCalc(car)
        For Each d In car
            sumOfCarPayment = sumOfCarPayment + d
        Next

        Dim histr As String
        histr = vbCrLf & "House Insurance Payment" & vbCrLf & ReturnMonthlyStringCalc(hi)
        For Each d In hi
            sumOfHouseInsurance = sumOfHouseInsurance + d
        Next

        Dim cistr As String
        cistr = vbCrLf & "Car Insurance Payment" & vbCrLf & ReturnMonthlyStringCalc(ci)
        For Each d In ci
            sumOfCarInsurance = sumOfCarInsurance + d
        Next

        Dim foodstr As String
        foodstr = vbCrLf & "Groceries Cost" & vbCrLf & ReturnMonthlyStringCalc(food)
        For Each d In food
            sumOfGroceries = sumOfGroceries + d
        Next

        Dim eostr As String
        eostr = vbCrLf & "Eating out expenses" & vbCrLf & ReturnMonthlyStringCalc(eo)
        For Each d In eo
            sumOfEatingOut = sumOfEatingOut + d
        Next

        Dim elecstr As String
        elecstr = vbCrLf & "Utility Payment" & vbCrLf & ReturnMonthlyStringCalc(elec)
        For Each d In elec
            sumOfElectricity = sumOfElectricity + d
        Next

        Dim cargasstr As String
        cargasstr = vbCrLf & "Car/Gas expenses" & vbCrLf & ReturnMonthlyStringCalc(cargas)
        For Each d In cargas
            sumOfCarGas = sumOfCarGas + d
        Next

        Dim childstr As String
        childstr = vbCrLf & "Child care costs" & vbCrLf & ReturnMonthlyStringCalc(child)
        For Each d In child
            sumOfChildcare = sumOfChildcare + d
        Next

        Dim spendingstr As String
        spendingstr = vbCrLf & "Other Spending" & vbCrLf & ReturnMonthlyStringCalc(spending)
        For Each d In spending
            sumOfSpending = sumOfSpending + d
        Next
        Dim totalexpensesforyear As Decimal = 0
        totalexpensesforyear = sumOfHousePayment + sumOfCarPayment + sumOfHouseInsurance + sumOfCarInsurance + sumOfGroceries + sumOfEatingOut + sumOfElectricity + sumOfCarGas + sumOfChildcare + sumOfSpending
        txtOutput.Text = housestr & carstr & histr & cistr & foodstr & eostr & elecstr & cargasstr & childstr & spendingstr & vbCrLf & "Total Expenses: " + totalexpensesforyear.ToString()
    End Sub

    Private Function ReturnMonthlyStringCalc(ByVal arr() As Decimal) As String
        ' So we dont type this 12 times we put it in a function and call it 12 times instead ;)

        ReturnMonthlyStringCalc = "January: " & arr(0) & vbCrLf & _
        "February: " & arr(1) & vbCrLf & _
        "March: " & arr(2) & vbCrLf & _
        "April: " & arr(3) & vbCrLf & _
        "May: " & arr(4) & vbCrLf & _
        "June: " & arr(5) & vbCrLf & _
        "July: " & arr(6) & vbCrLf & _
        "August: " & arr(7) & vbCrLf & _
        "September: " & arr(8) & vbCrLf & _
        "October: " & arr(9) & vbCrLf & _
        "November: " & arr(10) & vbCrLf & _
        "December: " & arr(11) & vbCrLf
    End Function

    Friend WithEvents btnAdd As System.Windows.Forms.Button
    Friend WithEvents btnCalc As System.Windows.Forms.Button
    Friend WithEvents cboType As System.Windows.Forms.ComboBox
    Friend WithEvents txtAmt As System.Windows.Forms.TextBox

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        ' This is a select statement which means we test the
        ' value of what we are selecting on which means cboType's
        ' SelectedIndex Property which returns which index is selected
        ' By using selectedindex our array's are set up
        ' so that the months coincide with the way we store them
        ' in our house() etc.. array's. Ie house(0) and cboMonth.Item(0)
        ' Are both january

        ' We need to get the value out of our textbox
        ' And since it is in a string convert it to a decimal
        Select Case cboType.SelectedIndex
            Case 0 ' Mortage Rent
                house(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 1 ' Car Payment
                car(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 2 ' House Insurance
                hi(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 3 ' Car Insurance
                ci(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 4 ' Food costs
                food(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 5 ' Eating out expenses
                eo(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 6 ' Electricity
                elec(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 7 ' Car and Gas expenses
                cargas(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 8 ' Child care costs
                child(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
            Case 9 ' Spending
                spending(cboMonth.SelectedIndex) = Convert.ToDecimal(txtAmt.Text)
        End Select

    End Sub
    Private Sub InitializeComponent()
        Me.btnAdd = New System.Windows.Forms.Button
        Me.btnCalc = New System.Windows.Forms.Button
        Me.cboType = New System.Windows.Forms.ComboBox
        Me.cboMonth = New System.Windows.Forms.ComboBox
        Me.txtAmt = New System.Windows.Forms.TextBox
        Me.txtOutput = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'btnAdd
        '
        Me.btnAdd.Location = New System.Drawing.Point(378, 33)
        Me.btnAdd.Name = "btnAdd"
        Me.btnAdd.Size = New System.Drawing.Size(67, 30)
        Me.btnAdd.TabIndex = 0
        Me.btnAdd.Text = "Add"
        Me.btnAdd.UseVisualStyleBackColor = True
        '
        'btnCalc
        '
        Me.btnCalc.Location = New System.Drawing.Point(378, 69)
        Me.btnCalc.Name = "btnCalc"
        Me.btnCalc.Size = New System.Drawing.Size(67, 28)
        Me.btnCalc.TabIndex = 1
        Me.btnCalc.Text = "Calculate"
        Me.btnCalc.UseVisualStyleBackColor = True
        '
        'cboType
        '
        Me.cboType.FormattingEnabled = True
        Me.cboType.Location = New System.Drawing.Point(39, 32)
        Me.cboType.Name = "cboType"
        Me.cboType.Size = New System.Drawing.Size(101, 21)
        Me.cboType.TabIndex = 2
        '
        'cboMonth
        '
        Me.cboMonth.FormattingEnabled = True
        Me.cboMonth.Location = New System.Drawing.Point(170, 33)
        Me.cboMonth.Name = "cboMonth"
        Me.cboMonth.Size = New System.Drawing.Size(123, 21)
        Me.cboMonth.TabIndex = 3
        '
        'txtAmt
        '
        Me.txtAmt.Location = New System.Drawing.Point(299, 33)
        Me.txtAmt.Name = "txtAmt"
        Me.txtAmt.Size = New System.Drawing.Size(73, 20)
        Me.txtAmt.TabIndex = 4
        '
        'txtOutput
        '
        Me.txtOutput.Location = New System.Drawing.Point(12, 103)
        Me.txtOutput.Multiline = True
        Me.txtOutput.Name = "txtOutput"
        Me.txtOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtOutput.Size = New System.Drawing.Size(459, 242)
        Me.txtOutput.TabIndex = 5
        '
        'FrmLogicalOperator
        '
        Me.ClientSize = New System.Drawing.Size(483, 357)
        Me.Controls.Add(Me.txtOutput)
        Me.Controls.Add(Me.txtAmt)
        Me.Controls.Add(Me.cboMonth)
        Me.Controls.Add(Me.cboType)
        Me.Controls.Add(Me.btnCalc)
        Me.Controls.Add(Me.btnAdd)
        Me.Name = "FrmLogicalOperator"
        Me.Text = "Calculate expenses"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Public WithEvents cboMonth As System.Windows.Forms.ComboBox

    Private Sub FrmLogicalOperator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' Lets add our months now..
        cboMonth.Items.Add("January")
        cboMonth.Items.Add("February")
        cboMonth.Items.Add("March")
        cboMonth.Items.Add("April")
        cboMonth.Items.Add("May")
        cboMonth.Items.Add("June")
        cboMonth.Items.Add("July")
        cboMonth.Items.Add("August")
        cboMonth.Items.Add("September")
        cboMonth.Items.Add("November")
        cboMonth.Items.Add("December")

        ' Now lets add our types
        cboType.Items.Add("Mortage/Rent")
        cboType.Items.Add("Car Payment")
        cboType.Items.Add("House Insurance")
        cboType.Items.Add("Car Insurance")
        cboType.Items.Add("Food Costs")
        cboType.Items.Add("Eating Out")
        cboType.Items.Add("Utility Bill")
        cboType.Items.Add("Car And Gas")
        cboType.Items.Add("Child care")
        cboType.Items.Add("Other Spending")


    End Sub

    Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
        Calculate()
    End Sub
    Friend WithEvents txtOutput As System.Windows.Forms.TextBox

    Protected Overrides Sub Finalize()
        MyBase.Finalize()
    End Sub
End Class
0
 

Author Comment

by:joleos
ID: 18867362
OK, this is starting to make some sense.  I'm unsure of a couple of things, but I'm looking them up to figure them out.  I've already gone in and made some changes and have added a few things, plus formatted everything.  I'm still going to figure out how to convert the numbers to currency, and, like you suggested, add some exception handling that will stop the user if they try and enter letters instead of numbers for the amount, and leave blanks for the other categories.  I think I'm going to try and add some message boxes to display the total for each category, and the grand total for the year. . . plus figure out some interaction messages.  Like I said, I understand the logic of alot of this, but I have such a hard time figuring out where everything goes.  I really appreciate all of your help, this is getting more fun now that I'm starting to understand it.  
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now