Click here to Skip to main content
15,910,980 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Antivirus Bloking My Application Pin
Luc Pattyn10-Dec-09 2:57
sitebuilderLuc Pattyn10-Dec-09 2:57 
QuestionApproximate zero values in an array Pin
Johnkokk9-Dec-09 23:52
Johnkokk9-Dec-09 23:52 
AnswerRe: Approximate zero values in an array Pin
Richard MacCutchan9-Dec-09 23:56
mveRichard MacCutchan9-Dec-09 23:56 
GeneralRe: Approximate zero values in an array Pin
David Skelly10-Dec-09 2:02
David Skelly10-Dec-09 2:02 
GeneralRe: Approximate zero values in an array Pin
Richard MacCutchan10-Dec-09 2:41
mveRichard MacCutchan10-Dec-09 2:41 
GeneralRe: Approximate zero values in an array Pin
EliottA10-Dec-09 2:45
EliottA10-Dec-09 2:45 
GeneralRe: Approximate zero values in an array Pin
Johnkokk10-Dec-09 6:08
Johnkokk10-Dec-09 6:08 
GeneralRe: Approximate zero values in an array Pin
nlarson1110-Dec-09 8:46
nlarson1110-Dec-09 8:46 
Dim arr() As Single = {17, 18, 0, 0, 24, 23, 0, 20, 0, 0, 0, 16}
Dim idx1 As Int16 = -1, idx2 As Int16 = -1
Dim FoundAZero As Boolean = False

For i As Int16 = 0 To arr.GetUpperBound(0)

    If Not FoundAZero Then
        If arr(i) = 0 Then
            FoundAZero = True 'once we find an zero the else will be used below until we find the next non zero
        Else
            idx1 = i 'hold on to the index every non zero
        End If
    Else
        If arr(i) <> 0 Then '
            idx2 = i 'hold on to the index of the non zero
            '--------------------------------------
            'get the value that's held in both indexes
            Dim val1 As Int16 = arr(idx1), val2 As Int16 = arr(idx2)
            Dim IncVal As Single

            'increment value is non zero 1 minus non zero 2 / the number of zeros between
            'the * -1 is whether or not we need to increment up or down depending on values of the array

            If val1 < val2 Then
                IncVal = (val2 - val1) / (idx2 - idx1)
            Else
                IncVal = ((val1 - val2) / (idx2 - idx1)) * -1
            End If

            For x As Int16 = idx1 + 1 To idx2 - 1
                arr(x) = arr(x - 1) + IncVal 'replace the 0 inbetween both indexes with the incremented value
            Next
            '--------------------------------------
            idx1 = idx2        'take the last none zero and set it to the first hold as we continue down the array
            FoundAZero = False 'reset finding a zero flag
        End If
    End If
Next


'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous

'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous


GeneralRe: Approximate zero values in an array Pin
Johnkokk10-Dec-09 20:52
Johnkokk10-Dec-09 20:52 
GeneralRe: Approximate zero values in an array Pin
nlarson1111-Dec-09 2:05
nlarson1111-Dec-09 2:05 
GeneralRe: Approximate zero values in an array Pin
Gideon Engelberth11-Dec-09 4:56
Gideon Engelberth11-Dec-09 4:56 
GeneralRe: Approximate zero values in an array Pin
Gideon Engelberth11-Dec-09 4:51
Gideon Engelberth11-Dec-09 4:51 
GeneralRe: Approximate zero values in an array Pin
peterchen11-Dec-09 2:43
peterchen11-Dec-09 2:43 
QuestionHow to get Hexadecimal code Pin
Pasan1489-Dec-09 23:01
Pasan1489-Dec-09 23:01 
AnswerRe: How to get Hexadecimal code Pin
Luc Pattyn9-Dec-09 23:38
sitebuilderLuc Pattyn9-Dec-09 23:38 
AnswerRe: How to get Hexadecimal code Pin
David Skelly10-Dec-09 2:16
David Skelly10-Dec-09 2:16 
Questionmimic HTML frame - Access subforms Pin
john john mackey9-Dec-09 12:47
john john mackey9-Dec-09 12:47 
AnswerRe: mimic HTML frame - Access subforms Pin
_Damian S_9-Dec-09 19:13
professional_Damian S_9-Dec-09 19:13 
GeneralRe: mimic HTML frame - Access subforms Pin
john john mackey10-Dec-09 5:30
john john mackey10-Dec-09 5:30 
QuestionKey press problem Pin
Pasan1489-Dec-09 6:58
Pasan1489-Dec-09 6:58 
AnswerRe: Key press problem Pin
Dave Kreskowiak9-Dec-09 7:25
mveDave Kreskowiak9-Dec-09 7:25 
AnswerRe: Key press problem Pin
Wes Aday9-Dec-09 7:54
professionalWes Aday9-Dec-09 7:54 
AnswerRe: Key press problem Pin
Luc Pattyn9-Dec-09 8:31
sitebuilderLuc Pattyn9-Dec-09 8:31 
QuestionError 53 (HRESULT 0x80070002) calling DLL from DLL Pin
Gennady Oster9-Dec-09 6:13
Gennady Oster9-Dec-09 6:13 
AnswerRe: Error 53 (HRESULT 0x80070002) calling DLL from DLL Pin
Dave Kreskowiak9-Dec-09 7:17
mveDave Kreskowiak9-Dec-09 7:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.