Results 1 to 11 of 11

Thread: Urgent Help needed...Comparing the output with previous values code in timer

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2009
    Posts
    18

    Unhappy Urgent Help needed...Comparing the output with previous values code in timer

    Hi everyone,

    I am new to VB programming. I am doing a project on comparing the output value of a code running on timer for every 580mseconds. the objective of this project is to compare the output value of the code to the next output value of same code which is running in timer for every 580ms. i will explain you clearly...here is my code....

    vb Code:
    1. Private Sub tm_get_position_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tm_get_position.Tick
    2.         If flag_track = 1 Then
    3. Dim macs(), prob_proc() As String
    4.                 macs = New String() {"00112052E170", "0011218F1A60", "00112052ECC0", "00112052D840", "00112052F010", "00112052E5D0"}
    5.                 prob_proc = New String() {"probs1", "probs2", "probs3", "probs4", "probs5", "probs6", "probs7", "probs8", "probs9", "probs10", "probs11", "probs12", "probs13", "probs14", "probs15", "probs16", "probs17", "probs18", "probs19", "probs20", "probs21", "probs22", "probs23", "probs24", "probs25", "probs26", "probs27", "probs28", "probs29", "probs30", "probs31", "probs32", "probs33", "probs34", "probs35", "probs36", "probs37", "probs38", "probs39", "probs40", "probs41", "probs42", "probs43", "probs44", "probs45", "probs46", "probs47", "probs48", "probs49", "probs50"}
    6.                 Dim k, kk As Integer
    7.                 Dim max As Long
    8.                 Dim position As Integer
    9.                 Dim probablistic(49) As Long
    10.  
    11.  
    12.                 For kk = 0 To 49
    13.                     For k = 0 To 5
    14.                         sqlcomm3.Connection = sqlconn
    15.                         sqlcomm3.CommandType = CommandType.StoredProcedure
    16.  
    17.                         sqlcomm3.CommandText = prob_proc(kk)
    18.                         sqlcomm3.Parameters.Clear()
    19.                         q = New SqlParameter
    20.                         q.ParameterName = "@macs"
    21.                         q.Direction = ParameterDirection.Input
    22.                         q.SqlDbType = SqlDbType.NVarChar
    23.                         q.Value = macs(k)
    24.                         sqlcomm3.Parameters.Add(q)
    25.                         q = New SqlParameter
    26.                         q.ParameterName = "@gaussian"
    27.                         q.Direction = ParameterDirection.Output
    28.                         q.SqlDbType = SqlDbType.Int
    29.                         sqlcomm3.Parameters.Add(q)
    30.                         Try
    31.                             sqlcomm3.ExecuteNonQuery()
    32.                         Catch ex As Exception
    33.                             q.Value = 0
    34.                         End Try
    35.  
    36.                         Try
    37.                             If Convert.IsDBNull(q.Value) = True Then
    38.                                 q.Value = 25
    39.                             End If
    40.  
    41.                             If q.Value < 25 Then
    42.                                 q.Value = 25
    43.                             End If
    44.  
    45.                             If k = 0 Then
    46.                                 probablistic(kk) = q.Value
    47.                             Else
    48.                                 probablistic(kk) = probablistic(kk) * q.Value
    49.                             End If
    50.                        Catch ex As Exception
    51.                             If k = 0 Then
    52.                                 probablistic(kk) = 25
    53.                             Else
    54.                                 probablistic(kk) = probablistic(kk) * 25
    55.                             End If
    56.                         End Try
    57.                     Next
    58.                 Next
    59.                 max = probablistic(0)
    60.                 For kk = 0 To 49
    61.                     If max < probablistic(kk) Then
    62.                         max = probablistic(kk)
    63.                         position = kk
    64.                     End If
    65.                 Next
    66.  
    67.                 Me.Controls.Remove(pbox)
    68.                 SuspendLayout()
    69.                 pbox.Image = System.Drawing.Image.FromFile(("C:\XandY\Image\dot1.jpg"))
    70.                 pbox.Top = pointx(position + 1).Y
    71.                 pbox.Left = pointx(position + 1).X
    72.                 pbox.Width = 10
    73.                 pbox.Height = 10
    74.                 Me.Controls.Add(pbox)
    75.                 pbox.BringToFront()
    76.                 ResumeLayout()
    77.            
    78.     End Sub


    Here we get an output value for the variable 'position' . the output will be (0-49).this code is running on timer. this code runs for every 580milliseconds. each and every time it gives the output value for variable 'position'. i need to compare the value of this variable for the next output value after 580milliseconds. can you please help me on this issue.i am not getting any idea how to compare this values. after storing the value i need to check for condition and get the result...can u please respond as soon as possible...
    Last edited by RobDog888; Jan 4th, 2009 at 07:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width