Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
9
Answers
index was out of range. must be non-negative
Mega Saraswati
9y
522
1
Reply
hello guys.. I'm mega in Indonesia. sorry for my english so bad.. I have script like :
private void btnDelete_Click(object sender, EventArgs e)
{
if (idx != -1)
{
int yy = Int32.Parse(txtTotal1.Text);
int ap = yy - Convert.ToInt16(arTotal[idx].ToString());
txtTotal1.Text = ap.ToString();
arId.RemoveAt(idx);
arNama.RemoveAt(idx);
arHarga.RemoveAt(idx);
arBanyak.RemoveAt(idx);
arTotal.RemoveAt(idx);
}
listView1.Items.Clear();
for (int i = 0; i < this.arId.Count; i++)
{
listView1.Items.Add(new ListViewItem(new string[] { arId[i].ToString(), arNama[i].ToString(), arHarga[i].ToString(), arBanyak[i].ToString(), arTotal[i].ToString() }));
}
}
but error in "int ap = yy - Convert.ToInt16(arTotal[idx].ToString());" can you help me ?
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
How to improve logic in programming?
Birthday Scheduler