delete
-
I am trying to add a delete button. I need it to delete the selected row in a datagrid. My Dataset is called as DS.I am working with an xmlfile.I already have an add button that is functioning properly:
Dim myRow As DataRow myRow = DS.Tables(0).NewRow() myRow(0) = TextBox1.Text myRow(1) = TextBox2.Text myRow(2) = TextBox3.Text myRow(3) = TextBox4.Text myRow(4) = TextBox5.Text DS.Tables(0).Rows.Add(myRow) TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear()
I just need the delete button. any help would be greatly apprecitated. -
I am trying to add a delete button. I need it to delete the selected row in a datagrid. My Dataset is called as DS.I am working with an xmlfile.I already have an add button that is functioning properly:
Dim myRow As DataRow myRow = DS.Tables(0).NewRow() myRow(0) = TextBox1.Text myRow(1) = TextBox2.Text myRow(2) = TextBox3.Text myRow(3) = TextBox4.Text myRow(4) = TextBox5.Text DS.Tables(0).Rows.Add(myRow) TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear()
I just need the delete button. any help would be greatly apprecitated.Datagrid? or Dataset? I am assuming you mean you want to delete a row from your dataset. If that is the case, you first need to know what row you want to delete. once you know that, you should be able to do DS.Tables(0).Rows.Remove or .Delete. Can't remember off the top of my head. Are you displaying this data in a datagrid object? If so, you will need to capture the id of the row you are on, and will then want to utilize the ItemCommand event of the DataGrid. Levi Rosol Blog By Levi[^]
-
Datagrid? or Dataset? I am assuming you mean you want to delete a row from your dataset. If that is the case, you first need to know what row you want to delete. once you know that, you should be able to do DS.Tables(0).Rows.Remove or .Delete. Can't remember off the top of my head. Are you displaying this data in a datagrid object? If so, you will need to capture the id of the row you are on, and will then want to utilize the ItemCommand event of the DataGrid. Levi Rosol Blog By Levi[^]
I want the user to be able to delete any row selected. Yes the data is displayed in a datagrid. how do I capture the ID? And just as a little memory refresher its Remove. thanks for the help.