Could someone check out this code it corrupts my project file
----------------------------------------------------------------------------
----
I have the following code in my project in varying ways this one being the
smallest. Last time I build a new solution added this project and dragged my
forms over which fixed the problem. However once I created another of this
type I corrupted my file again. By corrupted I mean that I get an error on
run but not on step through. ((see post here)) This code is an adaptation
of and evb program I inherited that works so I am guessing something either
is no longer supported or I have it wrong. And ideas?
Sub summarize_Understory()
Dim Sum As Double
Dim Nrated As Short
Dim Mean As Double
Sum = 0
Nrated = 0
Dim sumUnder() As TextBox
ReDim sumUnder(2)
sumUnder(0) = txtASum
sumUnder(1) = txtBSum
sumUnder(2) = txtCSum
Dim nratedUnder() As TextBox
ReDim nratedUnder(2)
nratedUnder(0) = txtANRated
nratedUnder(1) = txtBNRated
nratedUnder(2) = txtCNRated
Dim i As Short
For i = 0 To 2
If Not (Len(sumUnder(i).Text) = 0) Then
Sum = Sum + CDbl(sumUnder(i).Text)
End If
If Not (Len(nratedUnder(i).Text) = 0) Then
Nrated = Nrated + CDbl(nratedUnder(i).Text)
End If
Next
If Nrated > 0 Then
Mean = Sum / Nrated
Else
Mean = 0
End If
MessageBox.Show(Sum.ToString & Nrated.ToString & Mean.ToString)
End Sub
|