Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

Project but?

$
0
0
Hey guys
This is my first program in Vbasic
I am facing problem to add arrays into a variable in For Loop..
I dont knoq what to do? I am getting A zero in w2 because w1 never changes in (For loop) remains 0 as it was before the loop
I do need help to fix it and get the exact value
Code:

        Dim Moving, Period As Integer
        Dim f, w1, w2 As Integer
        Dim Moving1, Period1 As Integer
        Dim d() As Integer

        Moving = Val(TextBox21.Text)

        Period = Val(TextBox22.Text)

        d(0) = 0
        d(1) = Val(TextBox1.Text)
        d(2) = Val(TextBox2.Text)

        d(3) = Val(TextBox3.Text)
        d(4) = Val(TextBox4.Text)
        d(5) = Val(TextBox5.Text)
        d(6) = Val(TextBox6.Text)
        d(7) = Val(TextBox7.Text)
        d(8) = Val(TextBox8.Text)
        d(9) = Val(TextBox9.Text)
        d(10) = Val(TextBox10.Text)
        d(11) = Val(TextBox20.Text)
        d(12) = Val(TextBox19.Text)
        d(13) = Val(TextBox18.Text)
        d(14) = Val(TextBox17.Text)
        d(15) = Val(TextBox16.Text)
        d(16) = Val(TextBox15.Text)
        d(17) = Val(TextBox14.Text)
        d(18) = Val(TextBox13.Text)
        d(19) = Val(TextBox12.Text)
        d(20) = Val(TextBox11.Text)

        w1 = 0

        For f = (Period1 - Moving1) To f = (Period1 - 1)
            w1 = d(f) + w1


            f = f + 1

        Next

            w2 = (w1 / Moving)

            MsgBox(w2)


Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>