点击button,选择一个excel文件,并将文件名显示在textbox上。
private void btnSelectErrorTableFile_Click(object sender, RoutedEventArgs e) { var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Excel Files (*.xlsx)|*.xlsx" }; var result = openFileDialog.ShowDialog(); if (result == true) { this.tbErrorCodeTableFile.Text = openFileDialog.FileName; } }