Pessoal, estou com esse erro aqui...não estou achando o erro...
rum time error 13 type mismatch
Function findY(ByVal index As Integer) As Long
'Calcule o valor de y (corresponde a média dos dados através do ponto)
Dim i As Long
Dim startx As Long
Dim endx As Long
Static prevYneg As Boolean
startx = Int(index / Picture1.ScaleWidth * pWaveHeader.dwBufferLength / 2)
endx = Int((index + 1) / Picture1.ScaleWidth * pWaveHeader.dwBufferLength / 2)
If endx > pcSamplesPerSecond * pcMaxSeconds Then endx = pcSamplesPerSecond * pcMaxSeconds
findY = 0
If (startx = endx) Then
findY = data(startx)
Else
findY = data(startx)
For i = startx To endx
findY = findY + data(i)
Next i
findY = findY / (startx - endx)
End If
findY = findY / 2 ^ 16 * Picture1.ScaleHeight
If (prevYneg) Then
If (findY > TriggerLevel.Text * Picture1.ScaleHeight / 2) Then
edge_trigger (index)
prevYneg = False
End If
ElseIf (findY < TriggerLevel.Text * Picture1.ScaleHeight / 2) Then 'erro aqui'
prevYneg = True
End If
If (maxY < findY) Then maxY = findY
End Function