How to add items (text, string) to a listBox control in C#

1 Answer

0 votes
using System;
using System.Windows.Forms;

namespace workingframe
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.Items.Add("abc");
            listBox1.Items.Add("xyz");
        }
    }
}

/*
run:

abc
xyz

*/

 



answered Mar 15, 2016 by avibootz
edited Mar 15, 2016 by avibootz

Related questions

1 answer 1,922 views
1 answer 143 views
1 answer 144 views
1 answer 134 views
1 answer 167 views
1 answer 151 views
1 answer 182 views
...