Question Datagridview 'finding results function'

paul.in.loop

New member
Joined
May 12, 2013
Messages
1
Programming Experience
1-3
Hey, I'm just creating a system based on Datagridview and my paging code. I did complete system everything, works correct.
But sometime this funnction return true but doesn't mark correct row in Datagridview.
In my opinion I have somewhere value out of range.

Do you know this problem?

Conception:
If
somebody has clicked 'add' button
then
add new row
then
read first 10 rows from table then put in datagridview,
clear selection,
call find function in for and check each time if value returns true.
If true then
exit function


'funkcja znajdowania pozycji po dodaniu grupy, membera, i aktywnosci
Private Function Find(ByVal xxxxx As String) As Boolean

DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect

Dim count As Integer = 0
For Each Row As DataGridViewRow In DataGridView1.Rows

If DataGridView1.Rows(count).Cells(0).Value.ToString = xxxxx Then

DataGridView1.Rows(count).Selected = True
DataGridView1.FirstDisplayedScrollingRowIndex = count

Find = True
Exit Function

End If
count += 1

Next Row
Find = False

End Function
 
Back
Top