Vista中的SaveFileDialog异常 [英] SaveFileDialog Anomaly in Vista
本文介绍了Vista中的SaveFileDialog异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么这段代码中的SaveFileDialog为什么不能在WinXP中工作,而不能在Vista中工作?
Why does SaveFileDialog in this code work in WinXP and not in Vista?
using System;
using System.Windows.Forms;
namespace VistaDBBug
{
public delegate String RunDlgt();
public partial class frmDBBug : Form
{
private String m_strFileName = String.Empty;
public frmDBBug()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
RunDlgt dlgtRunReport = GetFileName;
// Asynchronously execute report generator
dlgtRunReport.BeginInvoke(SaveFileAs, dlgtRunReport);
}
private static String GetFileName()
{
return "Vista.txt";
}
private static void SaveFileAs(IAsyncResult ar)
{
SaveFileDialog sfdbOutFile = new SaveFileDialog();
sfdbOutFile.FileName = ((RunDlgt)ar.AsyncState).EndInvoke(ar);
sfdbOutFile.ShowDialog();
}
}
}
推荐答案
你好
>
感谢您的发帖!我建议您以
这篇关于Vista中的SaveFileDialog异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文