Hi Guys - I have a datagrid with N number of Rows, and I want to highlight each and every row for 5 seconds then move to the second row and then the third and so on until the last row.
the code is working so that I can scroll down every 5 seconds but I cant highlight the row keep it highlighted for 5 seconds and then highlight the next one and so on.
Here is the code so far, what am I doing wrong would be grateful if someone can please help me out.
And then I have this in my timer_tick sectionCode:Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click Dim mySelectQuery As String = "SELECT para, jtext FROM rooter where (jID = '" & jID & "') and mno between '" & FromA & "' and '" & ToA & "'" Dim sqConnection As New SQLiteConnection(path) Dim da As SQLiteDataAdapter = New System.Data.SQLite.SQLiteDataAdapter(mySelectQuery, sqConnection) Dim cb As System.Data.SQLite.SQLiteCommandBuilder = New System.Data.SQLite.SQLiteCommandBuilder(da) Dim dt As DataTable = New System.Data.DataTable Dim bindingSource1 As New BindingSource() DataGridView1.DataSource = BindingSource1 da.Fill(dt) bindingSource1.DataSource = dt With DataGridView1 .AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells .Font = New Font("ariel", 26, FontStyle.Regular) .ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single .CellBorderStyle = DataGridViewCellBorderStyle.Single .GridColor = Color.Black .RowHeadersVisible = False .ColumnHeadersVisible = False Dim column As DataGridViewColumn = DataGridView1.Columns(1) .Columns("ayahno").Visible = False .Columns("ayahno").ReadOnly = True column.Width = 1112 .DefaultCellStyle.WrapMode = DataGridViewTriState.True .SelectionMode = DataGridViewSelectionMode.FullRowSelect End With Timer1.Interval = 5000 Timer1.Enabled = True Timer1.Start() sqConnection.Close() sqConnection.Dispose() End Sub
Code:Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim rowcount = DataGridView1.RowCount For i As Integer = 0 To rowcount - 1 DataGridView1.FirstDisplayedScrollingRowIndex = 0 DataGridView1.CurrentCell = DataGridView1.Rows(i).Cells(1) DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Bisque DataGridView1.FirstDisplayedScrollingRowIndex = DataGridView1.FirstDisplayedScrollingRowIndex + 1 Next End Sub




Reply With Quote
