A very slow Loop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • giannis

    #1

    A very slow Loop

    At the below code i search for a value of a field of a BindingSource
    and when not found i search for the 40 earlier values inside a Loop.

    At the Access VB i used the same Loop with the command "DoCmd.FindReco rd"
    and the rapidity was very much big.

    Now at the VB this Loop be late very much (it is very slow). :(
    Why this happens and how can i resolve this problem ?
    Is there any other way to make this loop more fast ?


    Dim found As Integer = My.Forms.skitso .SKITSABind.Fin d("skitsa", w)

    If found -1 Then

    My.Forms.skitso .SKITSABind.Pos ition() = found

    Else

    p = Val(w)

    Do

    found = My.Forms.skitso .SKITSABind.Fin d("skitsa", Trim(Str(p)))

    If found < 0 Then p = p - 1

    If found -1 Or Val(w) - p 40 Or p < 15 Then Exit Do

    Loop

    If found -1 Then

    My.Forms.skitso .SKITSABind.Pos ition() = found

    End If

    Ånd If


  • rowe_newsgroups

    #2
    Re: A very slow Loop

    On Feb 12, 12:02 pm, "giannis" <zzzinob...@fre email.grwrote:
    At the below code i search for a value of a field of a BindingSource
    and when not found i search for the 40 earlier values inside a Loop.
    >
    At the Access VB i used the same Loop with the command "DoCmd.FindReco rd"
    and the rapidity was very much big.
    >
    Now at the VB this Loop be late very much (it is very slow). :(
    Why this happens and how can i resolve this problem ?
    Is there any other way to make this loop more fast ?
    >
    Dim found As Integer = My.Forms.skitso .SKITSABind.Fin d("skitsa", w)
    >
    If found -1 Then
    >
    My.Forms.skitso .SKITSABind.Pos ition() = found
    >
    Else
    >
    p = Val(w)
    >
    Do
    >
    found = My.Forms.skitso .SKITSABind.Fin d("skitsa", Trim(Str(p)))
    >
    If found < 0 Then p = p - 1
    >
    If found -1 Or Val(w) - p 40 Or p < 15 Then Exit Do
    >
    Loop
    >
    If found -1 Then
    >
    My.Forms.skitso .SKITSABind.Pos ition() = found
    >
    End If
    >
    Ånd If
    What exactly is this supposed to accomplish?

    Thanks,

    Seth Rowe

    Comment

    • punjab_tom

      #3
      Re: A very slow Loop

      sorry dog this dotnet crap is slower than Access is, for development
      and execution time

      Comment

      Working...