Listbox values add to label

Satyapriyanayak
Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 880
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
listBox1.Items.Add("a");
listBox1.Items.Add("b");
listBox1.Items.Add("c");
listBox1.Items.Add("d");
}

private void button1_Click(object sender, EventArgs e)
{

int i;
for (i = 0; i < listBox1.SelectedItems.Count; i++)
{

label1.Text = label1.Text + " " + listBox1.SelectedItem.ToString();


}


}
}
}

Comments or Responses

Login to post response