Hi guys, basically im writing a program where the user inputs the number of coffees they require from a number of drop down boxes, one for cappucino, espresso, iced coffee and latte. after this, there is a 'calculate' button which totals these up and displays them in a textbox.

my problem is (mostly cos im a vb novice) is that i also need to be able to count up the number of coffees selected over the use of the program, and to be able to average them out. these need to be displayed in a text box an another form.

basically so far, i have created variables in the drop down boxes.
anslatt = Val(Combolatt.Text) * 1.85 etc.

then added these up
bftakeaway = anscapp + ansespr + ansiced + anslatt
AnswerBox1.Text = bftakeaway


simple i know, but its the best i could do haha!

anyway thanks so much for reading and any help would be really appreciated!

Not sure what help you need, other than to point out that if you're averaging, you need to divide your bftakeaway variable by the number of different variable added together (anscapp, ansespr, ansiced, anslatt = 4 variables), so

AnswerBox1.Text = bftakeaway / 4

would be what you want.

Dang...now I want some coffee...

Hi guys, basically im writing a program where the user inputs the number of coffees they require from a number of drop down boxes, one for cappucino, espresso, iced coffee and latte. after this, there is a 'calculate' button which totals these up and displays them in a textbox.

my problem is (mostly cos im a vb novice) is that i also need to be able to count up the number of coffees selected over the use of the program, and to be able to average them out. these need to be displayed in a text box an another form.

basically so far, i have created variables in the drop down boxes.
anslatt = Val(Combolatt.Text) * 1.85 etc.

then added these up
bftakeaway = anscapp + ansespr + ansiced + anslatt
AnswerBox1.Text = bftakeaway


simple i know, but its the best i could do haha!

anyway thanks so much for reading and any help would be really appreciated!

How about post your code that you've been work so far..so we can understand more..also post more information..

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.