Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Calculations in VB6 (http://www.go4expert.com/forums/calculations-in-vb6-t26578/)

 dcdna05 27Aug2011 16:17

Calculations in VB6

1 Attachment(s)
Good Day to all Expert :)

I've been developing a program in visual basic 6.0 for my mother, I'm building a Database for the Information Records.

My Problem is i can't continue my project :( , im stuck on calculations of this area. So im posting here maybe somebody will help me for this. :)

I've attach an image here please open it to see the image. :)

I'm using a DBgrid to see contents populating from my Database Table using MS-Access.

The image above is only an example which i have to make in VB soon.

I need a code for calculating this

Example: RETURN + RETURN + RETURN and so on.. = Total in Textbox
New + New and so on... = Total in textbox

Note: Im not using a Number for this Im using a word/string. Eg. Return etc.

Regards
Neil

 ManzZup 27Aug2011 21:09

Re: Calculations in VB6

as i understood your problem, you have a certain list of categories. and in the list, the same item can be there n times, and you need to calc the no. of ti,es of each of the category?

first your given data is not really sufficient
i mean, first, can you iterate the list?
i mean are you done with the part where you can go through each item of the list?

if so there are several methods to solve your problem

1. you cna simply put some switch cases, which will see what the string is and update integer counter accordingly
2. the more professional way is that you make a list of key/value pairs [hash maps, lists]. make the pair as <string, int> where the key is category name, from there on it is just increasing the int value relevant to the String key

 dcdna05 28Aug2011 02:23

Re: Calculations in VB6