i have a datagrid and i am not sure which event to use or how to use it. I want a situation whereby a user clicks or selects an item and it shows in a textbox then i have a button that will delete that item from the database
Printable View
i have a datagrid and i am not sure which event to use or how to use it. I want a situation whereby a user clicks or selects an item and it shows in a textbox then i have a button that will delete that item from the database
you mean a datagridview + not a datagrid right?
they're 2 different controls.
anyway, how is your dgv bound to a datasource?
do you already have the code for deleting the row?
Its a datagrid view and this is how i am populating and binding the grid to datasource from the dbase
Dim da As SqlDataAdapter
ds = New DataSet
Dim cmd As New SqlCommand
cmd.CommandType = CommandType.Text
cmd.Connection = General.dbConnection
'Get Stock Items
cmd.CommandText = "Select * From _Zones"
da = New SqlDataAdapter(cmd)
da.Fill(ds, "Zones")
dgZones.DataSource = ds.Tables("Zones")
and i do not have the code to delete the selected item