0
我有一個Windows窗體中的OpenFileDialog,它運行得非常好,當我想在Excel加載項中執行相同操作時,它似乎沒有任何操作。下面是我的代碼的摘錄,但是我很努力地看到問題出在哪裏,因爲兩者的代碼都是相同的(文本框,openFileDialog和按鈕名稱相同)。在Excel加載項中,OpenFileDialog不起作用?
public partial class DashboardControl : UserControl
{
public DashboardControl()
{
InitializeComponent();
}
private void DashboardControl_Load(object sender, EventArgs e)
{
}
private void fileLocationText_TextChanged(object sender, EventArgs e)
{
}
private void openFile_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
}
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
fileLocationText.Text = openFileDialog1.FileName;
}
}