private void AddToList() { listBox1.Items.Clear(); if (stack.Peek() != null) { var array = stack.ToArray(); for (int i = array.Length - 1; i > -1; i--) { var o = (object[])array[i]; listBox1.Items.Add(o[0].ToString() + " " + o[1].ToString()); } } } private void button1_Click(object sender, EventArgs e) { stack.Push(new object[] { txtName.Text, txtRate.Text }); //if (result == 1) //{ // MessageBox.Show("Employee Lastname: " + txtName.Text + "\n Employee Payrate: " + txtRate.Text + ""); //} //else // MessageBox.Show("You can't add an empty value"); AddToList(); txtName.Clear(); txtRate.Clear(); } private void button2_Click(object sender, EventArgs e) { if (stack.Count > 0) { stack.Pop(); AddToList(); } }
Himanshu Manjarawala Sr. Software Engineer@AutomationAnywhere http://fieredotnet.wordpress.com/
Thanks, Sanjay
R D Patel
Thanks, Rajni Shekhar
Login to post response