0% found this document useful (0 votes)
16 views

Private Sub Byval As Byval As Handles Dim As Integer Dim To To As Double For To Next For To Step

This code handles the click event of a button. It calculates the average height and variance of projectile motion over a specified number of time intervals. It adds rows to a data grid view to display the time, height, and calculation count. It uses a for loop to calculate the height for each time interval using the projectile motion equation. It calculates the average height, variance, and displays the result in a text box.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Private Sub Byval As Byval As Handles Dim As Integer Dim To To As Double For To Next For To Step

This code handles the click event of a button. It calculates the average height and variance of projectile motion over a specified number of time intervals. It adds rows to a data grid view to display the time, height, and calculation count. It uses a for loop to calculate the height for each time interval using the projectile motion equation. It calculates the average height, variance, and displays the result in a text box.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.

EventArgs)
Handles Button1.Click
Dim I, TF, C, SH As Integer
Dim PH, V, T(0 To 100), H(0 To 100), NUME As Double
TF = Val(TextBox1.Text)
For I = 0 To TF - 1
DGV1.Rows.Add(TF)
Next
C=0
For I = 0 To TF - 1 Step 1
H(I) = 1 / 2 * 9.81 * I ^ 2
C=C+1
SH = SH + H(I)
DGV1.Rows(I).Cells(0).Value = C
DGV1.Rows(I).Cells(1).Value = I
DGV1.Rows(I).Cells(2).Value = H(I)
Next
PH = SH / C
REM CALCULO DE VARIANZA
For I = 0 To TF - 1 Step 1
NUME = NUME + (H(I) - PH) ^ 2
Next
V = NUME / C
TextBox2.Text = Str$(V)
End Sub
End Class

You might also like