Reden Rodriguez

Reden Rodriguez

  • NA
  • 137
  • 1.8k

how to delete an specific row/multiple array in datagridview

Sep 12 2018 1:46 AM
how to delete an specific row/multiple array element inside of a datagridview? i have this code
 
private void btnRemoveDamage_Click(object sender, EventArgs e)
{
txtDamageCode.Text = Interaction.InputBox("Enter damage code (separated by comma)", String.Empty, dmgList.Text, -1, -1);
string[]addDMG = txtDamageCode.Text.Split(',');
List add = new List();
for (int z = 0; z < addDMG.Length; z++)
{
string[] dmgdesc = new string[] { inGateRepo.GetDamageDescription(addDMG[z]) };
for (int x = 0; x < dmgdesc.Length; x++)
{
getDamage getdmg = new getDamage();
string[] dam = dmgdesc[x].Trim().Split('|');
for (int y = 0; y < dam.Length; y++)
{
switch (y)
{
case 0:
getdmg.damageCode = dam[y];
break;
case 1:
getdmg.damageDesc = dam[y];
break;
}
}
add.Add(getdmg);
}
}
dmgList.DataSource = add;
}
 
it works like this. i have 3 array with description in my datagridview but if i want 2 is the only one remain then i just type 2 and the rest will not be included
 
1|some description
2|some description
3|some description
how can i remove it like this  users.DeleteUser((GetAllUsers)lstUsers.CurrentRow.DataBoundItem);
i just want to delete only the current row not to type it again. 

Answers (2)