Imports CRAXDDRT20
Imports CrystalDecisions.CrystalReports.Engine

Public Class Form1Class Form1
    Inherits System.Windows.Forms.Form
    Private oRpt As New ReportDocument

Windows Form 設計工具產生的程式碼#Region " Windows Form 設計工具產生的程式碼 "

    Public Sub New()Sub New()
        MyBase.New()

        '此為 Windows Form 設計工具所需的呼叫。
        InitializeComponent()

        '在 InitializeComponent() 呼叫之後加入所有的初始設定

    End Sub

    'Form 覆寫 Dispose 以清除元件清單。
    Protected Overloads Overrides Sub Dispose()Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    '為 Windows Form 設計工具的必要項
    Private components As System.ComponentModel.IContainer

    '注意: 以下為 Windows Form 設計工具所需的程序
    '您可以使用 Windows Form 設計工具進行修改。
    '請勿使用程式碼編輯器來修改這些程序。
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button4 = New System.Windows.Forms.Button
        Me.CrystalReportViewer1 = New CrystalDecisions.Windows.Forms.CrystalReportViewer
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(8, 24)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 23)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "創建水晶報表"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(152, 24)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(88, 23)
        Me.Button2.TabIndex = 1
        Me.Button2.Text = "修改水晶報表"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(8, 64)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(96, 23)
        Me.Button3.TabIndex = 2
        Me.Button3.Text = "顯示創建報表"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(152, 64)
        Me.Button4.Name = "Button4"
        Me.Button4.TabIndex = 3
        Me.Button4.Text = "顯示修改報表"
        '
        'CrystalReportViewer1
        '
        Me.CrystalReportViewer1.ActiveViewIndex = -1
        Me.CrystalReportViewer1.Location = New System.Drawing.Point(8, 96)
        Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
        Me.CrystalReportViewer1.ReportSource = Nothing
        Me.CrystalReportViewer1.Size = New System.Drawing.Size(672, 424)
        Me.CrystalReportViewer1.TabIndex = 4
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 15)
        Me.ClientSize = New System.Drawing.Size(688, 525)
        Me.Controls.Add(Me.CrystalReportViewer1)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myCrystalReport As CRAXDDRT20.Report
        myCrystalReport = (New CRAXDDRT20.Application).NewReport
        Dim txtCompanyName As CRAXDDRT20.TextObject
        txtCompanyName = CType(myCrystalReport.Sections(1).AddTextObject("", 200, 300), CRAXDDRT20.TextObject)
        With txtCompanyName
            .Name = "CompanyName"
            .SetText("本報表由趙小陽設計")
            .Width = 10 * 567
            .Height = 1 * 567
        End With
        myCrystalReport.ReportTitle() = "動態創建報表的例子"
        myCrystalReport.SaveAs("c:/myCrystalReport.rpt", CRReportFileFormat.cr80FileFormat)
    End Sub

    Private Sub Button2_Click()Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim myCrystalReport2 As CRAXDDRT20.Report = (New CRAXDDRT20.Application).OpenReport("c:/myCrystalReport.rpt")
        Dim txtCompanyName2 As CRAXDDRT20.TextObject
        txtCompanyName2 = myCrystalReport2.Sections(1).ReportObjects.Item("CompanyName")
        With txtCompanyName2
            .SetText("小趙出版社")
            .Width = 5 * 567
            .Height = 1 * 567
        End With
        myCrystalReport2.ReportTitle() = "動態修改報表的例子"
        myCrystalReport2.SaveAs("c:/myCrystalReport2.rpt", CRReportFileFormat.cr80FileFormat)
    End Sub

    Private Sub Button3_Click()Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        oRpt.Load("c:/myCrystalReport.rpt")
        Me.CrystalReportViewer1.ReportSource = oRpt
    End Sub

    Private Sub Button4_Click()Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        oRpt.Load("c:/myCrystalReport2.rpt")
        Me.CrystalReportViewer1.ReportSource = oRpt
    End Sub
End Class

創建與修改水晶報表(代碼碎片)相关推荐

  1. 在 FROM 下打开水晶报表文件(代碼碎片)

    using System; using System.Drawing; using System.Collections; using System.ComponentModel; using Sys ...

  2. 創建oracle用戶及表空間,window,linux下創建oracle用戶及表空間 對比 易於學習

    1.window下創建oracle用戶及表空間 --創建數據表空間 create tablespace oras_data  --表空間的名字 logging datafile 'D:\oracle\ ...

  3. [Ms SQL] 基本創建、修改與刪除

    ##創建 table student, 內涵 id ,name ,tel三種columne,設定id為primary key create table student ( id int primary ...

  4. 水晶報表:金額轉換大寫12/8

    Visual Basic語法: dim sa,sb,sc as string sa=cstr({命令.amt}) sa=replace(sa,",","") d ...

  5. 用 Swift、Foursquare API 和 Realm 創建一個咖啡屋 App

    原文链接 : Building a Coffee Shop App with Swift, Foursquare API and Realm 原文作者 : De Vries Reinder 译文出自 ...

  6. [Minitab]如何創建一個全因子試驗計劃表?

    在產品優化或製程改善活動,挑選主要影響因子和確認其水平是必要過程,而利用全因子試驗計畫,將可有效提取主要影響因子和確認其水平.在此進行此必要過程之前,我們需先針對產品優化或製程改善活動創建一個試驗計劃 ...

  7. svn建立分支linux,linux命令——svn分支創建、合並

    一,svn分支與合並有什么用? 作程序的,對svn在熟悉不過了,但對svn分支熟悉的,我想並不多.因為一般情況下,是用不着svn分支的,其實也沒有那個必要.下面我例舉幾個需要用到svn分支的情況: 1 ...

  8. Firebase 入門:用 Swift 創建一個簡單的社交 App

    原文:Introduction to Firebase: Building a Simple Social App in Swift 作者:MATTHEW MAHER 译者:kmyhy 現在的 App ...

  9. SQL2008R2 Reporting Services 報表產生器 3.0 快速上手

    今天去客戶那邊教了一堂 SQL Server 2008 R2 Reporting Services 基礎課程,雖然短短三個小時能教的東西不多但重點應該都點到了,而且快速上手之後只要有資料在手,透過內建 ...

最新文章

  1. vue @click 绑定多个方法 执行顺序_Vue干货,学完这些就够用了
  2. varchar,nvarchar不同呀。小心出错
  3. View视图类与Dialog对话框通信实例
  4. Keil MDK-ARM下载 安装与和谐教程
  5. CSS Grid网格布局全攻略
  6. layui自定义查询条件html页面,Layui的数据表格+springmvc实现搜索功能的例子_飛雲_前端开发者...
  7. Redis分布式基础主从同步
  8. 北京Php月收入2w,给你北京户口,前提要辞掉月薪2w的工作,在月薪5千左右的岗位干10年,你干吗?...
  9. 什么是云存储技术与云存储服务?
  10. XML学习总结(一)——XML介绍
  11. ASP.NET中防止刷新页面造成表单重复提交
  12. html网页视频播放器代码,HTML网页制作视频播放器现成代码
  13. 联想微型计算机开机黑屏什么原因,联想笔记本电源键亮但黑屏怎么办
  14. 水箱建模最小二乘法_高位消防水箱考点汇总及历年真题!
  15. Day_03——MySQL数据库查询语句练习
  16. 什么是php PHP能干什么
  17. 零死角玩转stm32中级篇2-IIC总线
  18. 私域流量有什么特点?
  19. 计算机网络基本知识(一):分类
  20. LPS:美国国防部参与研发的操作系统

热门文章

  1. debug与DOSBox安装debug命令操作
  2. Java知识点06:队列(Queue)的offer/add函数,poll/remove函数,peek/element函数的区别
  3. ​LeetCode刷题实战631:设计 Excel 求和公式
  4. QQ Protect 的删除
  5. 【Tools】i1Profiler3.5安装教程详解
  6. 安装 anaconda 后无法运行,开始菜单没有启动项,安装文件夹缺失大量文件
  7. Chrome浏览器——报错解决:应用程序无法启动,因为应用程序的并行配置不正确。
  8. 使用Virtuso绘制电路图问题
  9. 高性能游戏本搭服务器,五款高性能游戏本推荐 爽玩各类3A大作
  10. 网易 天下2 的简单评论