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;
using System.IO;
namespace listbox_copy
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
listBox1.Items.Add("Raj");
listBox1.Items.Add("Ravi");
listBox1.Items.Add("Rahul");
}
private void btn_copy_Click(object sender, EventArgs e)
{
string s1 = "";
foreach (object item in listBox1.Items) s1 += item.ToString() + "\r\n";
Clipboard.SetText(s1);
}
}
}