Use Save as and custom save event.
Hi,
i want to use custom save dialog when user click on save command of the designer.So i have used the option using a custom event.
Config.DesignerSettings.CustomSaveDialog += DesignerSettings_CustomSaveDialog;
But once i used the above code it will replace the save as menu event as well.My requirement is once user click on save button i ned to save the report to database.and on save as event i need users to give the option of saving report in to the file system.
and my second question is once we have attached the custom event using the above code, i need to detach the event as well.i can see in the designer toolbar save button only enable when user has done changes.can we track that user changes? i meant it has been expose as a event or a property? then i can easily attached and detached the event.
tnx in advance
chaminda
i want to use custom save dialog when user click on save command of the designer.So i have used the option using a custom event.
Config.DesignerSettings.CustomSaveDialog += DesignerSettings_CustomSaveDialog;
But once i used the above code it will replace the save as menu event as well.My requirement is once user click on save button i ned to save the report to database.and on save as event i need users to give the option of saving report in to the file system.
and my second question is once we have attached the custom event using the above code, i need to detach the event as well.i can see in the designer toolbar save button only enable when user has done changes.can we track that user changes? i meant it has been expose as a event or a property? then i can easily attached and detached the event.
tnx in advance
chaminda
Comments
Sorry, both Save and SaveAs commands use the same code. If you replace the standard Save dialog, it will be used for SaveAs as well. You may add a button in your dialog to allow save to file.
Normally you should attach an event before running a designer, and detach it after closing the designer. You cannot cath the modified flag.
Any Event argument to check which button has clicked by user ?
chaminda
But if user click on save button again now that attached event is not working.is there a work around for that?
Hi ,
I could not find CustomSaveDialog in .NET version.I am using verison 1.9.11.0
Config.DesignerSettings.CustomSaveDialog += DesignerSettings_CustomSaveDialog;
Kind regards
notes: open the text file with excel ( separator = | ) and https://msdn.microsoft.com/en-us/library/dd460756.aspx
I solve it using the following way:
designerControl1.MainMenu.miFileSaveAs.Visible = false;
var buttonSaveAs = designerControl1.MainMenu.CreateMenuItem("save as", new EventHandler(MySaveAs));
designerControl1.MainMenu.miFile.SubItems.Insert(4, buttonSaveAs);
public void MySaveAs(object sender, EventArgs e)
{
using (SaveFileDialog dialog = new SaveFileDialog())
{
dialog.Filter = "Report files (*.frx)|*.frx";
// get default file name from e.FileName
dialog.FileName = ".frx";
if (dialog.ShowDialog() == DialogResult.OK)
{
designerControl1.Report.Save(dialog.FileName);
}
}
}
good luck🙂