I Want to make my program search and delete.. Iam Using MS ACCESS 2010

Public Class main

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        AddProd.Show()
        Me.Close()

    End Sub

    Private Sub TblInventoryBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.TblInventoryBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.InventoryDataSet)

    End Sub

    Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'InventoryDataSet.tblInventory' table. You can move, or remove it, as needed.
        Me.TblInventoryTableAdapter.Fill(Me.InventoryDataSet.tblInventory)
        btnSave.Enabled = False

    End Sub

    Private Sub btnEditProduct_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEditProduct.Click
        btnSave.Enabled = True
        MsgBox("You can now edit the database.")
        TblInventoryDataGridView.ReadOnly = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        MsgBox("Updates Saved.")
        btnSave.Enabled = False
        Me.TblInventoryTableAdapter.Update(Me.InventoryDataSet.tblInventory)
        TblInventoryDataGridView.ReadOnly = True
    End Sub

    Private Sub TblInventoryDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles TblInventoryDataGridView.CellContentClick
        TblInventoryDataGridView.ReadOnly = True

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        End
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click

`This is where i dont know what to put.. I want to delete a certain product after i added it or in which case already added but i dont want it on the record.`

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

'This is where i dont know what to put either.. I want to search for a certain product after i already added it.'

    End Sub


    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class

Would be glad if someone could help me.. This is really important to me.. Tomorrow's my Defense and this is the only problem i can't solve. Cheers!

'This is how to search in a data table
'Make sure your condition will get only one record
Dim row As DataRow() = Me.InventoryDataSet.tblInventory.Select("<enter your condition here>")

if you already have the search then you can now delete the data.        
If row.Length > 0 Then
    row(0).Delete()
End If


Hope that helps!
Be a part of the DaniWeb community

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