title: Allow only a text file in drag drop on a textbox using C#.Net
body: <p>I am working on a Windows Forms Application.</p>
  
  <p>During one Drag and Drop action on a <code>TextBox</code> control, I want to restrict the user to provide only a text file.</p>
  
  <pre><code>// drag drop module for input text file in textbox starts here
  private void textBoxInputTextFile_DragEnter(object sender, DragEventArgs e)
  {
      if (e.Data.GetDataPresent(DataFormats.FileDrop))
          e.Effect = DragDropEffects.Copy;
      else
          e.Effect = DragDropEffects.None;
  }
  
  private void textBoxInputTextFile_DragDrop(object sender, DragEventArgs e)
  {
      if(e.Data.GetData(DataFormats.FileDrop, true))
      {
      // Check if it is a text file
      // Okay if it is a text file or else give an error message
      }
  }
  </code></pre>
  
  <p>This code is just a sample from my previous folder drop action but now I want to restrict it to only one file and that too must be a text file. So that, when the drop action happens, it should check first if it is a text file or not and then do other stuff.</p>
  
  <p>How do I do that?</p>