hi,

how can i add a button to delete/edit a row in gridview which takes its data from database ?

thanks

Recommended Answers

All 5 Replies

you code it in the button click event

hey I'll even go one step further

Private Sub btnDelete_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnDelete.Click
    If Not DataGridView1.CurrentRow.IsNewRow Then
        DataGridView1.Rows.Remove(DataGridView1.CurrentRow)
    End If
End Sub

but it's not my code - it popped up by googling what you want

http://www.vb-helper.com/howto_2005_datagridview_delete_row.html

thank you both i will try it now. but one question how do i insert a button for each row in gridview?

^^^^ AnyOne on this please

I've not done this myself, I did find some things by searching . . .

I googled gridview embed a button for each row


looks like you're going to use itemtemplate to do this

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.