默认的文件名SaveFileDialog [英] Default Filename SaveFileDialog
本文介绍了默认的文件名SaveFileDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建 SaveFileDialog
与默认的文件名
从值 DataGridViewCells
到目前为止,我试过
private void buttonSave_Click(object sender, EventArgs e)
{
//first
//mySaveFileDialog.FileName = myDataGridView.SelectedCells[2].Value.ToString();
//second
SaveFileDialog saveFile = new SaveFileDialog();
saveFile.FileName = myDataGridView.SelectedCells[2].Value.ToString();
saveFile.ShowDialog();
}
谁能帮我解决这个问题?
Can anyone help me solve this?
推荐答案
在 SaveFileDialog
具有用于此目的的属性:<一href="http://msdn.microsoft.com/en-us/library/system.windows.controls.savefiledialog.defaultfilename%28v=vs.95%29.aspx"相对=nofollow> DefaultFileName
使用Silverlight或<一href="https://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filename(v=vs.110).aspx"相对=nofollow> 文件名
使用.NET
The SaveFileDialog
has a property intended for this purpose: DefaultFileName
using Silverlight or FileName
using .NET
您(不可编译)$ C $的问题Ç将成为:
Your (uncompilable) code from the question would become:
private void buttonSave_Click(object sender, EventArgs e)
{
SaveFileDialog mySaveFileDialog = new SaveFileDialog();
//Silverlight
mySaveFileDialog.DefaultFileName = myDataGridView.SelectedCells[2].Value.ToString();
//.NET
mySaveFileDialog.FileName = myDataGridView.SelectedCells[2].Value.ToString();
}
这篇关于默认的文件名SaveFileDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文