Hello all,

I made a texteditor, and i want to make it when i drag and drop an .txt file onto my .exe file of the texteditor the texteditor opens and the data of the .txt file is in a richTextBox.
Please help!

Recommended Answers

All 2 Replies

These things are called Command Line Arguments (for your reference).

You can retrieve them in a WinForms app by calling Environment.GetCommandLineArgs()

Command line arguments are space delimited, so if you entered /f:myfile.txt you would get "/f:myfile.txt" as a single argument in your application.

When you drag and drop, it simply passes the file path as an argument, which is exaclty what you want.

Here is a C# drag & drop from FileExplorer tutorial

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.