# Calculations in VB6

Discussion in 'Visual Basic ( VB )' started by dcdna05, Aug 27, 2011.

1. ### dcdna05New Member

Joined:
Aug 27, 2011
Messages:
2
0
Trophy Points:
0
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

File size:
7.6 KB
Views:
3
2. ### ManzZupNew Member

Joined:
May 9, 2009
Messages:
278
43
Trophy Points:
0
Occupation:
Production Manager:Software @ ZONTEK
Location:
Sri Lanka
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

3. ### dcdna05New Member

Joined:
Aug 27, 2011
Messages:
2
0
Trophy Points:
0