Question Annual income calculation help??

janu123

Member
Joined
Mar 11, 2012
Messages
8
Programming Experience
Beginner
Hi .....

I am doing a project...A sales Analysis what happen basically is ..you get sales data from a text file to a list box...where you are able to edit view and save any alterations. I created a menu strip Calculate>>>Annual income. So when somebody clicks Annual income the program should calculate the income and show it in the listbox below in "total".. If somebody can help i appreciate it. I have done abt 90% of the work and am stuck here!
 

Attachments

  • snap1.jpg
    snap1.jpg
    56.9 KB · Views: 39
Hi .....

I am doing a project...A sales Analysis what happen basically is ..you get sales data from a text file to a list box...where you are able to edit view and save any alterations. I created a menu strip Calculate>>>Annual income. So when somebody clicks Annual income the program should calculate the income and show it in the listbox below in "total".. If somebody can help i appreciate it. I have done abt 90% of the work and am stuck here!


Hello

I am not sure how much programming experience you have and don't want to insult you, but if it were me I would have put this into a DataGrid. Though as you have put it into a listbox my next bit of advice wold be to put the data into an Array / Arrays or even multidimensional array. This way you could change the data in the array/s as you changed the data in the listbox. If you took this a little further you could hold the totals for each column in another array or part of the multidimensional array and update this as you enter new data aswell.

If you don't want to do it this way then maybe just have a PricePer Array and a Totals Array IE:

Dim PricePer as Double() = {1,5,10,20,100}
Dim Totals(4) as Double

Then all you need to do is add up each column and times it by the correct element in the PricePer array IE: column 0 would be element 0 in the array

Hope this helps
 
Of course if you know about Structures you could hold the data in your own Structure array.

IE:

Public Structure Products
Dim 8Track as Integer
Dim Cassette as Integer
Dim CD as Integer
Dim BlueRay as Integer
Dim SSDFlash as Integer​
End Structure

and then assign this to a Variable for instance:

Dim ProductsSold as Products(11) and then hold all the data for the year in this. I have assigned 11 to the array so you have 12 (0 - 11) 1 for each month. Then it is a simple matter of looping through the structure array and adding up each column as you go.

Regards
 
Back
Top