krishnaraj s

krishnaraj s

  • NA
  • 4
  • 7.6k

DataGridControl and Timer

Sep 14 2012 6:18 AM
Hi, i am developing stock market project.Every 5 min updated realtime stockvalues(open,high,low,close and vol).select 5 stocks display this values using datagrid view control so 5 rows and 3 cols(Stock Name(textbox),price(textbox),search(bottons).i need 5 button click to change price 2 column values every 5 second.below coding running,5 button click display price value ,but 5 button only price remining 4 button d't change price.pls help me.i want 5 button click to change all price every 5 second.

code:


DGridStock_CellClick
      
        If e.ColumnIndex = 2 Then
            DGridStock.Rows(DGridStock.CurrentCellAddress.Y).Cells((DGridStock.CurrentCellAddress.X) - 1).Value = ComboBox1.Text
            DGridStock.Rows(DGridStock.CurrentCellAddress.Y).Cells(DGridStock.CurrentCellAddress.X).Style.ForeColor = Color.Green
            DGridStock.Rows(DGridStock.CurrentCellAddress.Y).Cells(DGridStock.CurrentCellAddress.X).Style.BackColor = Color.Red
            Symbol = ComboBox1.Text
            Timer1.Start()
        End If

    End Sub


Timer1_Tick

        Dim metaRTOpen As New Threading.Thread(AddressOf OpenData)
        metaRTOpen.Priority = Threading.ThreadPriority.Highest
        metaRTOpen.Start()
End Sub


Private Sub OpenData()
       
        Path = lblData.Text
      
        If InitComplete = False Then
            Counter = 0
            metaReader.OpenDirectory(Path)
            metaReader.OpenSecurityBySymbol(Symbol)

            If metaReader.MaInterval = 1 Then
                Priority = 1
            ElseIf metaReader.MaInterval = 5 Then
                Priority = 5
            End If

        DGridStock.Rows(DGridStock.CurrentCellAddress.Y).Cells((DGridStock.CurrentCellAddress.X) - 2).Value = Format(metaReader.dSeClose, "0.00")           
          
            metaReader.CloseSecurity()
            metaReader.CloseDirectory()
        End If
   

    End Sub