// Drag Drop private void TextBox1_DragDrop(object sender, DragEventArgs e) { // get all files droppeds if (e.Data.GetData(DataFormats.FileDrop) is string[] files && files.Any()) { Encrypt.ResetText(); foreach (string filePath in files) { if ((File.Exists(filePath) || Directory.Exists(filePath)) && filePath != files.Last()) { Encrypt.AppendText(filePath + Environment.NewLine); } else { Encrypt.AppendText(filePath); } } // End foreach } // End if }