Help w/ Find Method of Datarow....

Hey everyone! I would like to give the user the ability to search a Db. I added a textbox (for search criteria) and a search button. Here is the code I am using

Private Sub Button11_Click(ByVal sender As system.Object, ByVal e As System.EventArgs) Handles Button11.Click
Dim n As String = TextBox5.Text
Dim kmtbl As DataTable
kmtbl = Kmds1.Tables("kmtbl")
Dim FoundRow As DataRow = kmtbl.Rows.Find(n)
If Not (FoundRow Is Nothing) Then
MessageBox.Show(CType(FoundRow(1), String))
Else
MessageBox.Show("A key named " & _
n & " could not be found")
End If

I would like to display the value of the row matching that search criteria in a message box or datagrid. However, when I execute this code all I get is the messagebox w/ the else statement. It won't return the row value. Can someone please help, I'm new to Db programming.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories