OpenFileDialog default path

前端 未结 8 1404
甜味超标
甜味超标 2020-12-01 14:13
using (var openFileDialog1 = new OpenFileDialog())
        {
            openFileDialog1.Reset();
            if (!string.IsNullOrEmpty(ExcelFilePath))
            {         


        
8条回答
  •  悲哀的现实
    2020-12-01 14:52

    I don't think there is anything built in for that. Just check before you open the dialog:

    if (!Directory.Exists(initialDirectory))
    {
        openFileDialog1.InitialDirectory = @"C:\";
    }
    

提交回复
热议问题