title: How to implement Drag and Drop
body: <p>I am working on a project. It does with drag and drop this is the code I have right now.</p>
  
  <pre><code>   namespace WindowsFormsApplication1
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void listBox1_MouseDown(object sender, MouseEventArgs e)
          {
              listBox1.DoDragDrop(listBox1.SelectedItem.ToString(), DragDropEffects.Move);
          }
  
          private void listBox2_DragEnter(object sender, DragEventArgs e)
          {
              e.Effect = e.AllowedEffect;
          }
  
          private void listBox2_DragDrop(object sender, DragEventArgs e)
          {
              listBox2.Items.Add(e.Data.GetData(DataFormats.Text));
              listBox1.Items.Remove(listBox1.SelectedItem.ToString());
          }
  </code></pre>
  
  <p>It lets you add to the second list box but I am trying to get it where you can also move the item back to first listbox if you want to. Do I repeat the code for the second list box as I did for the first one or is there a line of code I could just add.Also how can you tell if your program is “unbreakable”. Thanks.</p>