frmviewkh.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:3k
- Imports System.Configuration
- Public Class frmviewkh
- Inherits System.Windows.Forms.Form
- #Region " Windows 窗体设计器生成的代码 "
- Public Sub New()
- MyBase.New()
- '该调用是 Windows 窗体设计器所必需的。
- InitializeComponent()
- '在 InitializeComponent() 调用之后添加任何初始化
- End Sub
- '窗体重写 dispose 以清理组件列表。
- Protected Overloads Overrides 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 窗体设计器所必需的
- Private components As System.ComponentModel.IContainer
- '注意: 以下过程是 Windows 窗体设计器所必需的
- '可以使用 Windows 窗体设计器修改此过程。
- '不要使用代码编辑器修改它。
- Friend WithEvents khViewer As DataDynamics.ActiveReports.Viewer.Viewer
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.khViewer = New DataDynamics.ActiveReports.Viewer.Viewer
- Me.SuspendLayout()
- '
- 'khViewer
- '
- Me.khViewer.BackColor = System.Drawing.SystemColors.Control
- Me.khViewer.Dock = System.Windows.Forms.DockStyle.Fill
- Me.khViewer.Location = New System.Drawing.Point(0, 0)
- Me.khViewer.Name = "khViewer"
- Me.khViewer.ReportViewer.CurrentPage = 0
- Me.khViewer.ReportViewer.MultiplePageCols = 3
- Me.khViewer.ReportViewer.MultiplePageRows = 2
- Me.khViewer.Size = New System.Drawing.Size(592, 293)
- Me.khViewer.TabIndex = 0
- Me.khViewer.TableOfContents.Text = "Contents"
- Me.khViewer.TableOfContents.Width = 200
- Me.khViewer.Toolbar.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
- '
- 'frmviewkh
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(592, 293)
- Me.Controls.Add(Me.khViewer)
- Me.Name = "frmviewkh"
- Me.Text = "frmviewkh"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public strquery As String
- Public sqlString As String
- Private Sub frmviewkh_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- khprint()
- End Sub
- Private Sub khprint()
- Try
- If sqlString = String.Empty Then
- sqlString = "select * from wz_kh where 拼音码 like '%" & strquery & "%'or 客户编号 like '%" & strquery & "%'"
- End If
- Dim rpt As New rpxkh
- Dim myDS As New DataDynamics.ActiveReports.DataSources.SqlDBDataSource
- myDS.ConnectionString = ConfigurationSettings.AppSettings.Get("constr")
- myDS.SQL = sqlString
- rpt.DataSource = myDS
- Me.khViewer.Document = rpt.Document
- rpt.Run(False)
- Catch ex As Exception
- MessageBox.Show(Me, "报表错误: " + ex.Message + "; " + ex.InnerException.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- End Sub
- End Class