تبلیغات

            int []a = new int[100];
            int i = 0;
            if (e.KeyChar == 13)
            {
                if (textBox1.Text == "")
                {
                    MessageBox.Show("invalid number");
                }
                else
                {
                    a[i] = Convert.ToInt32(textBox1.Text);
                    i++;
                    listBox1.Items.Add(textBox1.Text);
                    textBox1.Clear();
                    textBox1.Focus();
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int j,a;
            j = listBox1.Items.Count;
            for(int i=(j);i>a;int a;if0;i--)
            {
                listBox2.Items.Add(i);
            }