Skip to content

Instantly share code, notes, and snippets.

@pradesa
Last active December 17, 2015 10:49
Show Gist options
  • Save pradesa/5597932 to your computer and use it in GitHub Desktop.
Save pradesa/5597932 to your computer and use it in GitHub Desktop.
Find String in DataGridView
'Prosesnya adalah membandingkan string dari Object Textbox dengan Kolom di DataGridView
'Kalo datanya ketemu, akan di set sebagai Current Row
Public Shared Sub _FindRow(ByVal _DataGridView As DataGridView, ByVal _String As String)
Dim data As String
For x = 0 To _DataGridView.Rows.Count - 1
data = _DataGridView.Rows(x).Cells(1).Value
Try
If UCase(data.Substring(0, _STring.Length)) = UCase(_STring) Then
_DataGridView.CurrentCell = _DataGridView.Rows(x).Cells(0)
_DataGridView.CurrentRow.Selected = True
Exit For
End If
Catch ex As Exception
exit for
End Try
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment