Hello!!!!
I am a novice programmer though, I am trying to code a vb 6.0 system that calculates total marks from the exams done and return the output. I only know the simplest way of addition, but I want the way to compute total by taking only the exams taken by a student, say the system has provided 12 options for the entry while the student took only 7 exams, and so the everage will be x/7. what of the student who takes 10 exams and using the same system to compute?

my simplest code is here:

Dim total, gpa As Integer
total = Int(Text19.Text) + Int(Text20.Text) + Int(Text21.Text) + Int(Text22.Text) + Int(Text23.Text) + Int(Text24.Text) + Int(Text25.Text)
Label24.Caption = total
gpa = total / 7
Label25.Caption = gpa

Thank you!!

First, VB6 is so old that it's something you need to avoid for any new system. As to the divisor you should chnage that to a variable that holds the number of exams.

Hello rproffitt

Please give me just an example , I will appreciate so much

Do you still have to use vb6?
What rproffit means that you have to make a variable call it count or something.
Get it through a textbox or other input.
Line 4 of your code should then read gpa = total / count

I get you, but I was restricted to use vb 6.0, however I am also using .net platform

That's confusing. I've worked in vb 6.0 and also .net but never found any crossover from vb6 to .net. How strange.

I am requesting you to assist me with a simple code for either vb 6.0 or .net please

First thing to remark is your dim of gpa as Integer. It most likely is a decimal.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.