DialogResult result3 = MessageBox.Show("Proceed With Checkout?", "Request Granted",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (result3 == DialogResult.Yes)
{
int quantity = Int32.Parse(quantityTextBox.Text);
if (quantity ==1)
{
this.BindingContext[iTEMDataSet, "ITEM"].RemoveAt(this.BindingContext[iTEMDataSet, "ITEM"].Position);
}
else if (quantity > 1)
{
quantity = quantity - 1;
quantityTextBox.Text = Convert.ToString(quantity);
//update database here.
}
}
if (result3 == DialogResult.No)
{
//quantity = quantity - 1;
//quantityTextBox.Text = Convert.ToString(quantity);
}
}
catch
{
MessageBox.Show("error!");
}
}
//正如您所看到的,这个程序允许我从列表中删除项目的数量,但是当数量== 1时,当删除时,它将变为数量== 0因此,整行将被删除,遗憾的是,我希望删除行中特定的选定项目..但相反,最顶层的项目行将被删除。
感谢您的帮助(: