Click here to Skip to main content
16,011,120 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalemail save help Pin
Mohammad Daba'an25-Jan-05 0:30
Mohammad Daba'an25-Jan-05 0:30 
GeneralControl needed Pin
Member 166542124-Jan-05 21:43
Member 166542124-Jan-05 21:43 
GeneralRe: Control needed Pin
Ritesh123424-Jan-05 22:40
Ritesh123424-Jan-05 22:40 
GeneralRe: Control needed Pin
GuruPandian24-Jan-05 23:46
GuruPandian24-Jan-05 23:46 
GeneralAutomatic SMS Response System with VB.Net Pin
xponentbd24-Jan-05 20:16
xponentbd24-Jan-05 20:16 
GeneralSystem time Pin
a_david12324-Jan-05 20:06
a_david12324-Jan-05 20:06 
GeneralRe: System time Pin
Dave Kreskowiak25-Jan-05 3:40
mveDave Kreskowiak25-Jan-05 3:40 
GeneralExport Into Multiple File PDF/EXCEL/WORD Pin
bluechip_asia24-Jan-05 17:29
bluechip_asia24-Jan-05 17:29 
Laugh | :laugh: 'Created By I Made Agus W.A (IMAWA)
Mad | :mad: 'For Educational Purpose Only

Rose | [Rose]
'Imports statement
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

'Put into Web Form Designer Generated Code
Protected WithEvents oRpt As YourRPT = Nothing

'Sub Procedure, Ready to use/call
Private Sub ExportApplication()
---- GET DATASET (you can change it with your own function to get table)
Dim dt As DataTable
Try
dt = GetTableData("View_StockCard", "", "")
---- END OF GET DATASET

---- CREATE REPORT
oRpt = New YourRPT
oRpt.SetDataSource(dt)

--- SEND PARAMETER TO REPORT (OPTIONAL)
oRpt.SetParameterValue("DateStart", DateFrom.DateValue.ToShortDateString)
oRpt.SetParameterValue("DateFinish", DateUntil.DateValue.ToShortDateString)
--- END OF SEND PARAMETER

View_Report.ReportSource = oRpt
Dim exp As ExportOptions
Dim req As ExportRequestContext
Dim st As System.IO.Stream
Dim b() As Byte
Dim pg As Page
--- View_Report As CrystalDecisions.Web.CrystalReportViewer*
pg = View_Report.Page
exp = New ExportOptions

--- ExportFormat As System.Web.UI.WebControls.DropDownList*
--- ExportFormat value is pdf, xls, doc
If ExportFormat.SelectedValue = "pdf" Then
exp.ExportFormatType = ExportFormatType.PortableDocFormat
exp.FormatOptions = New PdfRtfWordFormatOptions
Else
If ExportFormat.SelectedValue = "xls" Then
exp.ExportFormatType = ExportFormatType.Excel
exp.FormatOptions = New ExcelFormatOptions
Else
exp.ExportFormatType = ExportFormatType.WordForWindows
exp.FormatOptions = New PdfRtfWordFormatOptions
End If
End If

req = New ExportRequestContext
req.ExportInfo = exp
With oRpt.FormatEngine.PrintOptions
.PaperSize = PaperSize.PaperLegal
.PaperOrientation = PaperOrientation.Portrait
End With
st = oRpt.FormatEngine.ExportToStream(req)
pg.Response.ClearHeaders()
pg.Response.ClearContent()
pg.Response.ContentType = "application/" + ExportFormat.SelectedValue
ReDim b(st.Length)
st.Read(b, 0, CInt(st.Length))
pg.Response.BinaryWrite(b)
pg.Response.End()
dt.Dispose()
Catch ex As Exception
ShowError(ex.Message)
End Try

End Sub

'Example (When imgExport Clicked then SaveAs)
Private Sub imgExport_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Handles imgSearch.Click
ExportApplication()
End Sub




:-> I Made Agus W.A
---------------------
IT Programmer Staff
PT Tunas Ridean Tbk.
QuestionHow To Download then Save As Any Registered File Name Pin
bluechip_asia24-Jan-05 17:05
bluechip_asia24-Jan-05 17:05 
GeneralVB 2 VB.net Pin
cliffton24-Jan-05 15:24
cliffton24-Jan-05 15:24 
GeneralRe: VB 2 VB.net Pin
GuruPandian24-Jan-05 16:15
GuruPandian24-Jan-05 16:15 
QuestionHow to add data to combox box? Pin
viettho24-Jan-05 12:13
viettho24-Jan-05 12:13 
AnswerRe: How to add data to combox box? Pin
Syed Abdul Khader24-Jan-05 13:58
Syed Abdul Khader24-Jan-05 13:58 
GeneralVB.NET Listboxes Pin
Jaydeanster24-Jan-05 10:35
Jaydeanster24-Jan-05 10:35 
GeneralCan't use MessageBox.Show in Visual Studio Project Pin
fdstfgsdrtyreytryre24-Jan-05 10:23
fdstfgsdrtyreytryre24-Jan-05 10:23 
GeneralRe: Can't use MessageBox.Show in Visual Studio Project Pin
Tom John24-Jan-05 22:15
Tom John24-Jan-05 22:15 
GeneralRe: Can't use MessageBox.Show in Visual Studio Project Pin
mtone25-Jan-05 1:52
mtone25-Jan-05 1:52 
GeneralRe: Can't use MessageBox.Show in Visual Studio Project Pin
Anonymous25-Jan-05 2:52
Anonymous25-Jan-05 2:52 
GeneralRe: Can't use MessageBox.Show in Visual Studio Project Pin
mtone25-Jan-05 5:40
mtone25-Jan-05 5:40 
QuestionHow can I modify a cell value on Datagrid ? (VB.NET) Pin
rafavasbr24-Jan-05 8:10
rafavasbr24-Jan-05 8:10 
QuestionHow can I modify a cell value on Datagrid ? Pin
rafavasbr24-Jan-05 8:09
rafavasbr24-Jan-05 8:09 
AnswerRe: How can I modify a cell value on Datagrid ? Pin
Anonymous25-Jan-05 6:19
Anonymous25-Jan-05 6:19 
GeneralClosing form and form childs crisis! Pin
carlos_rocha23-Jan-05 22:47
carlos_rocha23-Jan-05 22:47 
GeneralRe: Closing form and form childs crisis! Pin
GuruPandian24-Jan-05 16:39
GuruPandian24-Jan-05 16:39 
Generalnetwork programming question for advanced Pin
alain_yaghi23-Jan-05 22:35
alain_yaghi23-Jan-05 22:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.