Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 12th, 2009, 07:10 AM
Authorized User
Join Date: Nov 2007
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hughesie78
Default set SaveFileDialog to save crystal report

I have a button a form which opens a save file dialog and saves images.
I now want to add functionality to the button so that it saves a crystal report that im viewing in a crystalreportviewer which is also on my form.
How can I do this, ive tried accessing the report source property of the viewer but I cannot set the save as I have done with the .gif etc.
Here is my code, anyone got a solution
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
' Displays a SaveFileDialog so the user can save the Image
' assigned to Button2.
Dim saveFileDialog1 As New SaveFileDialog
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif|All files (*.*)|*.*"""
saveFileDialog1.Title = "Save an Image File"
Dim rptname As String
rptname = Me.CrystalReportViewer1.ReportSource
' If the file name is not an empty string open it for saving.
If saveFileDialog1.FileName <> "" Then
' Saves the Image via a FileStream created by the OpenFile method.
Dim fs As System.IO.FileStream = CType _
(saveFileDialog1.OpenFile(), System.IO.FileStream)
' Saves the Image in the appropriate ImageFormat based upon the
' file type selected in the dialog box.
' NOTE that the FilterIndex property is one-based.
Select Case saveFileDialog1.FilterIndex
Case 1
Me.button2.Image.Save(fs, _
Case 2
Me.button2.Image.Save(fs, _
Case 3
Me.Button2.Image.Save(fs, _
Case 4
' I want to save the report being viewed in CrystalReportViewer1 as excel.

End Select
End If
End Sub
Thank You

Similar Threads
Thread Thread Starter Forum Replies Last Post
set Oracle procedure as source for a crystal report Hughesie78 Crystal Reports 0 May 20th, 2009 08:16 AM
How to set default format for crystal report as RT shikha09 BOOK: Professional Crystal Reports for VS.NET 0 May 29th, 2007 01:23 AM
Using SaveFileDialog to save SQL DB file jscammell VB Databases Basics 4 April 14th, 2007 10:02 AM
How to set password to exported Crystal Report jdaulagar Beginning VB 6 0 January 10th, 2007 04:19 PM
Save crystal report as image [URGENT] usamaalam Crystal Reports 1 February 18th, 2005 07:03 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.