It's not a trivial exercise to validate a file path on a Windows PC. There are a few special cases depending on the file system and operating subsystem:
Popularity: 42% [?]
It's not a trivial exercise to validate a file path on a Windows PC. There are a few special cases depending on the file system and operating subsystem:
Popularity: 42% [?]
It's easy to display an RTF file — that was embedded as a resource in a C# program — in a Windows Form RichTextControl.
Popularity: 17% [?]
It's easy to extract an application's own icon in C#:
form.Icon = Icon.ExtractAssociatedIcon( Application.ExecutablePath );
The ExtractAssociatedIcon static method on the Icon class (in System.Drawing) extracts the associated icon from any file. By supplying the Application.ExecutablePath (in System.Windows.Forms), you extract the application's own icon.
Popularity: 16% [?]
Sadly there is no built-in function in System.IO that will copy a folder and its contents. Following is a simple recursive algorithm that copies a folder, its sub-folders and files, creating the destination folder if needed. For simplicity, there is no error handling; an exception will throw if anything goes wrong, such as null or invalid paths or if the destination files already exist.
Popularity: 33% [?]
For some operations such as logging on to a web site or downloading a web page, you may not know how long it will take the operation to finish. So instead of showing a progress bar with a specified percent complete, you can set the .NET ProgressBar to cycle continuously.
Popularity: 37% [?]
Here is the easiest way to read an entire text file into a C# string:
string s = System.IO.File.ReadAllText( path );
Popularity: 51% [?]