Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBS Calculator

Reply
 
Old 09-09-2009   #1 (permalink)
M.K


 
 

VBS Calculator

Dear all,

I write script which have InputBox for x date for example if i write 3 the
follow by 3 inputbox, now i want to Calculate all the last 3 inputbox so if i
was enter 1 2 3 than
msgbox will be total 6

Script is

S =InputBox

for S = 1 to x

InputBox "(Enter #)"

Next


msgbox "The Total is " & Sum i

my problem with msgbox which dont appear the total how i can do it

Thanx

My System SpecsSystem Spec
Old 09-09-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: VBS Calculator


"M.K" <MK@xxxxxx> wrote in message
news:3AC87776-5DA0-4C79-8463-DE8EB649F861@xxxxxx
Quote:

> Dear all,
>
> I write script which have InputBox for x date for example if i write 3 the
> follow by 3 inputbox, now i want to Calculate all the last 3 inputbox so
> if i
> was enter 1 2 3 than
> msgbox will be total 6
>
> Script is
>
> S =InputBox
> for S = 1 to x
> InputBox "(Enter #)"
> Next
> msgbox "The Total is " & Sum i
>
> my problem with msgbox which dont appear the total how i can do it
>
> Thanx
Is this the homework for your study course? Where do you set a value for x?


My System SpecsSystem Spec
Old 09-09-2009   #3 (permalink)
mr_unreliable


 
 

Re: VBS Calculator

Pegasus [MVP] wrote:
Quote:

> Is this the homework for your study course?
>
Yes, it does sound like a homework assignment.
And presenting three askboxes in a row is awkward,
to say the least.

How about asking the user to put all the input
parameters into the first (and only) askbox.
For example "enter your three addends separated
by plus signs". Like this: 1+2+3.

Or if the lesson plan has reached "hta" files,
then just use an hta as a "graphical user interface"
(gui) and present three text boxes for the parameters.
Er wait -- in html they are called input tags.

cheers, jw

My System SpecsSystem Spec
Old 09-10-2009   #4 (permalink)
M.K


 
 

Re: VBS Calculator

no study course, it's self study.

the vaule of x is variable.

so if you open the script will appear inputbox and if you enter for example
2 it will follow by 2 inputbox and if enter 3 it follow by 3 inputbox so if
follow by 3 inputbox and i enter in it the following 5, 2 and 3 than i want
msgbox be 5 + 2 + 3 = 10

"Pegasus [MVP]" wrote:
Quote:

>
> "M.K" <MK@xxxxxx> wrote in message
> news:3AC87776-5DA0-4C79-8463-DE8EB649F861@xxxxxx
Quote:

> > Dear all,
> >
> > I write script which have InputBox for x date for example if i write 3 the
> > follow by 3 inputbox, now i want to Calculate all the last 3 inputbox so
> > if i
> > was enter 1 2 3 than
> > msgbox will be total 6
> >
> > Script is
> >
> > S =InputBox
> > for S = 1 to x
> > InputBox "(Enter #)"
> > Next
> > msgbox "The Total is " & Sum i
> >
> > my problem with msgbox which dont appear the total how i can do it
> >
> > Thanx
>
> Is this the homework for your study course? Where do you set a value for x?
>
>
>
My System SpecsSystem Spec
Old 09-10-2009   #5 (permalink)
M.K


 
 

Re: VBS Calculator

no i dont want Like this: 1+2+3. because maybe i want add other funcation
like the average or the MIN or MAX



"mr_unreliable" wrote:
Quote:

> Pegasus [MVP] wrote:
Quote:

> > Is this the homework for your study course?
> >
>
> Yes, it does sound like a homework assignment.
> And presenting three askboxes in a row is awkward,
> to say the least.
>
> How about asking the user to put all the input
> parameters into the first (and only) askbox.
> For example "enter your three addends separated
> by plus signs". Like this: 1+2+3.
>
> Or if the lesson plan has reached "hta" files,
> then just use an hta as a "graphical user interface"
> (gui) and present three text boxes for the parameters.
> Er wait -- in html they are called input tags.
>
> cheers, jw
>
>
My System SpecsSystem Spec
Old 09-10-2009   #6 (permalink)
Pegasus [MVP]


 
 

Re: VBS Calculator

Here is the code you posted:

S =InputBox
for S = 1 to x
InputBox "(Enter #)"
Next
msgbox "The Total is " & Sum i

Unfortunately it makes no sense. The InputBox function requires at least one
argument - see the detailed description (plus example!) in the help file
script56.chm which you can download from the Microsoft site. It should
probably look like this:
s = InputBox("Please enter a number", "My Calculator")

After you get the InputBox function right, the variable S will reflect the
number you entered. The next line of code should then probably read:

for x = 1 to S
instead of
for S = 1 to x

In other words, you had this line back to front.


"M.K" <MK@xxxxxx> wrote in message
news:0E2497D7-12C6-46B2-BCFE-8769E8E3BC89@xxxxxx
Quote:

> no study course, it's self study.
>
> the vaule of x is variable.
>
> so if you open the script will appear inputbox and if you enter for
> example
> 2 it will follow by 2 inputbox and if enter 3 it follow by 3 inputbox so
> if
> follow by 3 inputbox and i enter in it the following 5, 2 and 3 than i
> want
> msgbox be 5 + 2 + 3 = 10
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
RE: Calculator Vista performance & maintenance
Calculator Vista General
Calculator Vista General
Calculator gets in the way. Vista installation & setup
calculator Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46