View Single Post
 
Old 10-24-2017, 01:56 AM
SwsCheez SwsCheez is offline
Newcomer
 
Join Date: Oct 2012
Posts: 13
Default How to loop each row of datagrid

Please help a newb. Here is my code. I am trying to loop each row of a datagrid every little while. I want the row's information to appear in the text boxes for each piece of row. This way I can compare date with an If Then. Here is my code so far. It displays only the top row. Essentially, I want to run an If Then against each row.

Dim v_SelectRow As Integer

For Each row As DataGridViewRow In DtRemindersDataGridView.Rows

TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""

Try

' v_SelectRow = Me.DtRemindersDataGridView.CurrentRow.Index
TextBox9.Text = Me.DtRemindersDataGridView.Item(0, v_SelectRow).Value
TextBox10.Text = Me.DtRemindersDataGridView.Item(1, v_SelectRow).Value
TextBox11.Text = Me.DtRemindersDataGridView.Item(2, v_SelectRow).Value

TextBox12.Text = Me.DtRemindersDataGridView.Item(3, v_SelectRow).Value
TextBox13.Text = Me.DtRemindersDataGridView.Item(4, v_SelectRow).Value
TextBox14.Text = Me.DtRemindersDataGridView.Item(5, v_SelectRow).Value
Catch ex As Exception
End Try

Next row
__________________
I'll procrastinate tomorrow
Reply With Quote