Sprache auswählen

Dieses CSharp (C#) Code Snippet zeigt, wie man den User mit Hilfe der OpenFileDialog Control eine Datei auswählen lässt.

 

private void OpenFileDialog_Example()
{
    OpenFileDialog myOpenFileDialog = new OpenFileDialog();

    // optional filter to restrict file types
    myOpenFileDialog.Filter = "CSV Files|*.csv";

    if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
    {
        string selectedFileName = myOpenFileDialog.FileName;

        // do whatever you like with the selected filename
    }
}