[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

Find and remove items from Datagridview

Is it possible to search for a specific text in a colum / row and then remove it automatically without any additional buttons. Please provide novice instructions or code help thanks.
0
Jack_Jones
Asked:
Jack_Jones
  • 2
1 Solution
 
Shahan AyyubSenior Software Engineer - iOSCommented:
Hi!

Do you wish to remove the whole row(if text found in row(or cell of a row)) or emptied the cell(if found in the cell) ?

Also are you using bound datagridview ?
0
 
Jack_JonesAuthor Commented:
it's a bound datagridview, and the whole row would be deleted. Bound by the datagridview receives it's data from a database.
0
 
CodeCruiserCommented:
Try

reportData.DefaultView.RowFilter = "Description='" & txtDescription.Text & "'"
if reportData.DefaultView.Count = 1 Then
   reportData.DefaultView.Item(0).Delete()
End If
0
 
Jack_JonesAuthor Commented:
Thank you CodeCruiser ;)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now