hey,
pls help me..
i need to check(compare) whether the value in the textbox (say textbox1) present in particular table(field)..

Recommended Answers

Do you know in which row,column,cell you have the value? If not do it in a loop and compare.

Jump to Post

All 3 Replies

Do you know in which row,column,cell you have the value? If not do it in a loop and compare.

You could use the DataView to find and compare your values. From MSDN -->
Click Here

here is a pattern you can try.

  Dim dt As New DataTable
  With dt
     .Columns.Add("c1", GetType(String))
     .Columns.Add("c2", GetType(String))
     .Rows.Add(New Object() {"hi", "fred"})
     .Rows.Add(New Object() {"hi", "barney"})
  End With
  Dim SelectionField As String = "c2"
  Dim res() As DataRow = dt.Select("[" & SelectionField & "]='" & TextBox1.Text.Trim & "'")
  If res.Length = 0 Then
     'not found
  Else
     'do something
  End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.