How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid
How to loop each row of datagrid How to loop each row of datagrid
How to loop each row of datagrid
Go Back  Xtreme Visual Basic Talk > > > How to loop each row of datagrid


Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
Old 10-30-2017, 10:53 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 59
Default

Hi,

v_SelectRow is never assigned to the currentrow as it's commented out.
Even so, I'm not sure the current row index would change during your loop.

You could try
Code:
For  v_SelectRow = 0 to dataGridView1.rows.count-1
instead.
Reply With Quote
Reply

Tags
row, v_selectrow.value, v_selectrow, textbox11.text, textbox14.text, textbox13.text, textbox12.text, textbox10.text, textbox9.text, loop, datagrid, code, newb, datagridviewrow, integer, catch, exception, piece, compare, boxes, information, rows, text, date, displays


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid How to loop each row of datagrid
How to loop each row of datagrid
How to loop each row of datagrid
 
How to loop each row of datagrid
How to loop each row of datagrid
 
-->