vb 水晶报表打印
vb里面的水晶报表打印控件:CrystalReportViewer
用到的dll文件:
水晶报表打印其实很简单,只要创建报表对象,再对其传递数据就可以打印出来。当然所传递的数据要与水晶报表设计里面的数据一致:
- Public Overloads Sub ShowDialog(ByVal netDs As DataSet, ByVal strPath As String, Optional ByVal showPrint As Boolean = True, Optional ByVal showExport As Boolean = True)
- Try
- If netDs.Tables().Rows.Count > Then
- Dim rpt As New ReportDocument
- rpt.Load(strPath)
- rpt.SetDataSource(netDs)
- CRV.ReportSource = rpt
- CRV.ShowPrintButton = showPrint
- CRV.ShowExportButton = showExport
- Dim t As New ComboBox
- t.Visible = True
- ShowDialog()
- Else
- MsgBox("Not print Data!", MsgBoxStyle.Critical)
- End If
- Catch ex As Exception
- MsgBox(ex.ToString)
- End Try
- End Sub
调用例子:在其他设计界面,当要打印之时,直接传递参数到打印界面即可。
- Dim daOM As SqlDataAdapter
- Dim cmbOM As SqlCommandBuilder
- Dim dsOM As New DataSet
- Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Try
- daOM = New SqlDataAdapter("select top 5 * from facd321 ", GetConn)
- cmbOM = New SqlCommandBuilder(daOM)
- daOM.Fill(dsOM, "OM")
- With dg
- .DataSource = dsOM.Tables("OM")
- .WindowLaguage = myDataGrid.myDatagrid.LanguageType.English
- .FilterBar = True
- Dim ii As Int16
- For ii = To .Splits().DisplayColumns.Count -
- .Splits().DisplayColumns(ii).Locked = True
- Next
- End With
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error")
- End Try
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Try
- Me.Cursor = Cursors.WaitCursor
- Dim f As New Form1
- AddBarcodeImages(dsOM.Tables())
- f.ShowDialog(dsOM, Application.StartupPath & "\Reports\bundle.rpt")
- Catch ex As Exception
- MsgBox(ex.ToString)
- Finally
- Me.Cursor = Cursors.Default
- End Try
- End Sub
报表设计:
运行效果:
vb 水晶报表打印的更多相关文章
- JS调用水晶报表打印翻页按钮事件
默认的水晶报表打印按钮.翻页按钮太小,并且样式不好调整,考虑自己做一个按钮,然后调用水晶报表的按钮事件. 在实际操作中发现可以在.net按钮的服务器端事件中调用翻页方法: CrystalReportV ...
- ASP.NET Dev ASPxGridView控件使用 ASP.NET水晶报表打印
1.ASPxGridView控件使用 2.ASP.NET水晶报表客户端打印 3.javascript打印 4.ASPxGridView根据Textbox查询 5. ASPxGridView 列宽 1. ...
- C#下水晶报表打印自定义纸张
在VB6中,如果要自定义纸张很方便: Rpt.PaperSize = crPaperUser Rpt.SetUserPaperSize lZZG, lZZK 但在C#中却不行了,没有发现 SetU ...
- 水晶报表WEB方式下不打印的问题
水晶报表版本是10.2.3600.0,是vs2005自带的.功能原来正常,服务器重做后不能打印,但是导出功能正常. 研究的大概情况: 1.水晶报表的web相关代码位于\aspnet_client\sy ...
- VS2015环境下Crystal Reports(水晶报表)的安装使用
1.首先下载Crystal Reports13对于Visual Studio 2015支持的2个文件. CRforVS_13_0_17 CRforVS_redist_install_64bit_13_ ...
- (转)VS2010结合水晶报表做条码标签打印功能
本文转载自:http://blog.sina.com.cn/s/blog_552ca1400100y6dd.html 先来个功能效果图: 大家都知道VS2005和VS2008软件本身是包含水晶报表插件 ...
- Asp.Net中使用水晶报表
Asp.Net中使用水晶报表(上) 在我们对VS.Net中的水晶报表(Crystal Reports)进行研究之前,我和我朋友对如何将这个复杂的东东加入我们的Web应用有着非常的好奇心.一周以后,在阅 ...
- Asp.Net 中使用 水晶报表(上)
Asp.Net中使用水晶报表(上) 在我们对VS.Net中的水晶报表(Crystal Reports)进行研究之前,我和我朋友对如何将这个复杂的东东加入我们的Web应用有着非常的好奇心.一周以后,在阅 ...
- (转)VS.NET2010水晶报表安装部署[VS2010]
本文转载自:http://www.cnblogs.com/xiaofengfeng/p/3325793.html 欢迎C#高手加盟QQ群:9340166 水晶报表VS2010版IDE安装标准版SAP ...
随机推荐
- NVIDIA GeForce GTX 960 设备是不可移动的,无法弹出
系统环境 系统:win7_x64; matlab版本:matlab2017b试用版: GPU:NVIDIA GeForce GTX 960: 问题描述: 第一次使用深度学习实现代码,运行的是matla ...
- Ubuntu 速配指南:开启3D桌面特效
http://www.lupaworld.com/article-205494-1.html 安装compizconfig-settings-manager(以下简称ccsm) 在终端里输入:sud ...
- Windows10中启用原来的Windows照片查看器方法
前言: ============================================== Windows10 版系统自带很多垃圾应用,图片查看器弄得很不好用,还是习惯Windows7的,自 ...
- CTF竞赛(简介)
一.解体模式(Jeopardy) 可通过互联网或现场网络参与,解决网络安全技术挑战题目,并以分值和时间排名. 题目主要包括:逆向,漏洞挖掘与利用,web渗透,密码,取证,隐写,安全编程 二.攻防模式( ...
- @Transactional + FetchType.LYZY (hibernate) <---> Exception: could not initialize proxy - no Session;
转自: https://blog.csdn.net/blueheart20/article/details/52912023 4.问题的解决 尝试1: 在Service方法中新增了@Transact ...
- LM算法的推导过程
- stenciljs 学习十 服务器端渲染
stenciljs提供了 ssr 支持,对于express 最简单的就是使用提供的中间件 express 集成 const express = require('express'); const ...
- VdcEye manager
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/u011652271/article/details/24878335 VdcEye manager ...
- 【转】每天一个linux命令(12):more命令
原文网址:http://www.cnblogs.com/peida/archive/2012/11/02/2750588.html more命令,功能类似 cat ,cat命令是整个文件的内容从上到下 ...
- VS2010编译和运行项目错误
打开工程提示如下: The 'Microsoft.Data.Entity.Design.BootstrapPackage.BootstrapPackage, Microsoft.Data.Entity ...