I am trying to save a xml file generated in the code using Savedialogue.
I have given the following code in my click button command.
var saveDialog = new Microsoft.Win32.SaveFileDialog()
{
Filter = "Loan Parameters(*.xml)|"
};
if (saveDialog.ShowDialog() == false)
{
return;
}
// XML Serialization and Binary Encoding
byte[] buffer = LoanDataHelper.SerializeModel(loanParameterValueConfig);
if (buffer != null)
{
LoanDataHelper.WriteStreamToFile(buffer, saveDialog.FileName, LoanDataHelper.FileFormat.Normal);
}
I am using mvvm model .On running I am getting exception as filename is not getting the value that I am passing in the savedialogue window.It is always empty string.
I could not figure out what i am missing here.
Please help.
Thanks in advance
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Afzaal Ahmad ZeeshanPosted May 19, 2015, 5:20 AM
if(saveDialog.CheckFileExists) {// File is present...
// Write your remaining code here..
}
Yoko YokoPosted May 19, 2015, 5:05 AM
Dipankar BiswasPosted May 19, 2015, 4:37 AM