0% found this document useful (0 votes)
25 views

Datatable: 'Me - Windowstate Formwindowstate - Maximized

This document contains code for a class called KartuDisposisi that handles printing a report. When the form loads, it sets the report viewer to print layout mode and calls the print method. The print method connects to a SQL database, runs queries to retrieve data and specifications, determines the report template to use based on the number of specifications, sets the report data source, and refreshes the report viewer to display the report. It also contains a form closing event handler that does not close the form.

Uploaded by

lik Paay
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Datatable: 'Me - Windowstate Formwindowstate - Maximized

This document contains code for a class called KartuDisposisi that handles printing a report. When the form loads, it sets the report viewer to print layout mode and calls the print method. The print method connects to a SQL database, runs queries to retrieve data and specifications, determines the report template to use based on the number of specifications, sets the report data source, and refreshes the report viewer to display the report. It also contains a form closing event handler that does not close the form.

Uploaded by

lik Paay
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Imports MySql.Data.

MySqlClient
Imports System.Data.DataTable
Imports Microsoft.Reporting.WinForms
Imports System.Drawing.Printing
Public Class KartuDisposisi
Public dt0 As New DataTable
Private Sub KartuDisposisi_Load(sender As System.Object, e As System.EventArgs)
Handles MyBase.Load
'Me.WindowState = FormWindowState.Maximized
Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
print()
End Sub

Private Sub print()


koneksisql()
Dim SDA As New MySqlDataAdapter
Dim DS As New DataSetDisposisi
Dim str As String
str = "select
a.*,c.TC30_MinimumSpek,TC30_MaksimumSpek,TC95_MinimumSpek,TC95_MaksimumSpek,MH_MinimumSpe
k,MH_MaksimumSpek,TC30_minspek,TC30_makspek,TC95_minspek,TC95_makspek,MH_minspek,MH_maksp
ek, b.disposisi,ydate_shift,waktu from (select
TESTNO,BARCODE,TXNDATE,shf,batch_no,WORKSTN,COMP_NO,LOT_NO,TCA,TCB,MH,QC_CHECK from
testrheo where shf like '%T%' And qc_check = 'NG' and testno='" & TXTESTNO.Text & "') a
"
str = str & " left join histdisp b on a.TESTNO = b.testno"
str = str & " left join panduandisposisi c on a.COMP_NO = c.Compound"
SDA.SelectCommand = New MySqlCommand(str, dbconn)
SDA.Fill(DS.Tables(0))
ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Dim tpspk As String
dt0.Clear()
Dim strsql0 = "select tipespek from panduandisposisi where compound='" &
TXITEMCODE.Text & "' "
'MsgBox(strsql0)
dbdata = New MySqlDataAdapter(strsql0, dbconn)
dbdata.Fill(dt0)
If dt0.Rows.Count > 0 Then
tpspk = dt0.Rows(0).Item(0).ToString
If tpspk.ToUpper = "2 JENIS" Then
ReportViewer1.LocalReport.ReportPath =
System.Environment.CurrentDirectory & "\Report1.rdlc"
ElseIf tpspk.ToUpper = "3 JENIS" Then
ReportViewer1.LocalReport.ReportPath =
System.Environment.CurrentDirectory & "\Report2.rdlc"
End If
End If
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(New
Microsoft.Reporting.WinForms.ReportDataSource("DataSetDisposisi", DS.Tables(0)))
ReportViewer1.DocumentMapCollapsed = True
Me.ReportViewer1.RefreshReport()
End Sub

Private Sub KartuDisposisi_FormClosing(sender As System.Object, e As


System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Return
End Sub
End Class

You might also like