Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
9
Reply
index was out of range. must be non-negative
Mega Saraswati
Jun 25 2015 10:41 PM
501
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 ?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
How to improve logic in programming?
Birthday Scheduler