TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mega Saraswati
NA
25
2.9k
index was out of range. must be non-negative
Jun 25 2015 10:41 PM
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 ?
Reply
Answers (
9
)
How to improve logic in programming?
reading data from sql server in vb.net