Problems with printing

hawkseye

Active member
Joined
Dec 4, 2004
Messages
28
Programming Experience
Beginner
Hello,

im trying to print my form. It has some labels, graph etc on it which are drawn based on the values in the database. The problem is when i print the form only the portion that is visible on the screen is printed rest of the part( which is above/below) does not show in the printout. Please can any one tell me what im doing wrong
below is the code
Imports Microsoft.Win32

Imports System.Drawing

Imports System.Drawing.Printing

Imports System.Drawing.Drawing2D

Imports System.Data.SqlClient

Public Class report

Inherits System.Windows.Forms.Form

Public holeIdq As String

Dim countRec As Integer = 0

Dim imgLocation As String = ""

WithEvents docToPrint As New Printing.PrintDocument

#
Region " Windows Form Designer generated code "

Public Sub New(ByVal holeId As String)

MyBase.New()

holeIdq = holeId

InitializeComponent()

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents Panel1 As System.Windows.Forms.Panel

Friend WithEvents Panel2 As System.Windows.Forms.Panel

Friend WithEvents Label3 As System.Windows.Forms.Label

Friend WithEvents Label4 As System.Windows.Forms.Label

Friend WithEvents Label5 As System.Windows.Forms.Label

Friend WithEvents Label6 As System.Windows.Forms.Label

Friend WithEvents Label8 As System.Windows.Forms.Label

Friend WithEvents Label9 As System.Windows.Forms.Label

Friend WithEvents Label10 As System.Windows.Forms.Label

Friend WithEvents Label11 As System.Windows.Forms.Label

Friend WithEvents Label12 As System.Windows.Forms.Label

Friend WithEvents Panel3 As System.Windows.Forms.Panel

Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox

Friend WithEvents SqlAdapter1 As System.Data.SqlClient.SqlDataAdapter

Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection

Friend WithEvents lblCompany As System.Windows.Forms.Label

Friend WithEvents lblName As System.Windows.Forms.Label

Friend WithEvents lblHeading As System.Windows.Forms.Label

Friend WithEvents Label1 As System.Windows.Forms.Label

Friend WithEvents Label2 As System.Windows.Forms.Label

Friend WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter

Friend WithEvents SqlSelectCommand2 As System.Data.SqlClient.SqlCommand

Friend WithEvents lblGwt As System.Windows.Forms.Label

Friend WithEvents Label25 As System.Windows.Forms.Label

Friend WithEvents Label23 As System.Windows.Forms.Label

Friend WithEvents Label18 As System.Windows.Forms.Label

Friend WithEvents Label24 As System.Windows.Forms.Label

Friend WithEvents Label22 As System.Windows.Forms.Label

Friend WithEvents Label17 As System.Windows.Forms.Label

Friend WithEvents Label16 As System.Windows.Forms.Label

Friend WithEvents Label15 As System.Windows.Forms.Label

Friend WithEvents Label14 As System.Windows.Forms.Label

Friend WithEvents Label13 As System.Windows.Forms.Label

Friend WithEvents txtDateStart As System.Windows.Forms.Label

Friend WithEvents txtDateEnd As System.Windows.Forms.Label

Friend WithEvents txtGroundElev As System.Windows.Forms.Label

Friend WithEvents txtGwt As System.Windows.Forms.Label

Friend WithEvents txtholeDia As System.Windows.Forms.Label

Friend WithEvents txtCompanyRep As System.Windows.Forms.Label

Friend WithEvents txtNorthcoord As System.Windows.Forms.Label

Friend WithEvents txtEastCoord As System.Windows.Forms.Label

Friend WithEvents txtSurvey As System.Windows.Forms.Label

Friend WithEvents txtLogged As System.Windows.Forms.Label

Friend WithEvents txtJobRefNo As System.Windows.Forms.Label

Friend WithEvents SqlProfileTable As System.Data.SqlClient.SqlDataAdapter

Friend WithEvents SqlSelectCommand3 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlSptFile As System.Data.SqlClient.SqlDataAdapter

Friend WithEvents SqlSelectCommand4 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlDataAdapter2 As System.Data.SqlClient.SqlDataAdapter

Friend WithEvents SqlSeland5 As System.Data.SqlClient.SqlCommand

Friend WithEvents txtDrilling As System.Windows.Forms.Label

Friend WithEvents SqlSelectCommand5 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlUpdateCommand2 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand

Friend WithEvents SqlDataAdapter3 As System.Data.SqlClient.SqlDataAdapter

Friend WithEvents sqlcountval As System.Data.SqlClient.SqlCommand

Friend WithEvents myPicArea As System.Windows.Forms.PictureBox

Friend WithEvents graphScaleArea As System.Windows.Forms.PictureBox

Friend WithEvents btnEnlarge As System.Windows.Forms.Label

Friend WithEvents Button1 As System.Windows.Forms.Button

Friend WithEvents Label7 As System.Windows.Forms.Label

Friend WithEvents PrintDialog1 As System.Windows.Forms.PrintDialog

Friend WithEvents PrintPreviewDialog1 As System.Windows.Forms.PrintPreviewDialog

<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()

Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(report))

Me.Panel1 = New System.Windows.Forms.Panel

Me.lblHeading = New System.Windows.Forms.Label

Me.Panel2 = New System.Windows.Forms.Panel

Me.txtDrilling = New System.Windows.Forms.Label

Me.txtJobRefNo = New System.Windows.Forms.Label

Me.txtLogged = New System.Windows.Forms.Label

Me.txtSurvey = New System.Windows.Forms.Label

Me.txtEastCoord = New System.Windows.Forms.Label

Me.txtNorthcoord = New System.Windows.Forms.Label

Me.txtCompanyRep = New System.Windows.Forms.Label

Me.txtholeDia = New System.Windows.Forms.Label

Me.txtGwt = New System.Windows.Forms.Label

Me.txtGroundElev = New System.Windows.Forms.Label

Me.txtDateEnd = New System.Windows.Forms.Label

Me.txtDateStart = New System.Windows.Forms.Label

Me.lblGwt = New System.Windows.Forms.Label

Me.Label2 = New System.Windows.Forms.Label

Me.Label1 = New System.Windows.Forms.Label

Me.Label12 = New System.Windows.Forms.Label

Me.Label11 = New System.Windows.Forms.Label

Me.Label10 = New System.Windows.Forms.Label

Me.Label9 = New System.Windows.Forms.Label

Me.Label8 = New System.Windows.Forms.Label

Me.Label6 = New System.Windows.Forms.Label

Me.Label5 = New System.Windows.Forms.Label

Me.Label4 = New System.Windows.Forms.Label

Me.Label3 = New System.Windows.Forms.Label

Me.Panel3 = New System.Windows.Forms.Panel

Me.lblCompany = New System.Windows.Forms.Label

Me.lblName = New System.Windows.Forms.Label

Me.PictureBox1 = New System.Windows.Forms.PictureBox

Me.Label7 = New System.Windows.Forms.Label

Me.SqlAdapter1 = New System.Data.SqlClient.SqlDataAdapter

Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand

Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection

Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand

Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter

Me.SqlSelectCommand2 = New System.Data.SqlClient.SqlCommand

Me.Label25 = New System.Windows.Forms.Label

Me.Label23 = New System.Windows.Forms.Label

Me.Label18 = New System.Windows.Forms.Label

Me.Label24 = New System.Windows.Forms.Label

Me.Label22 = New System.Windows.Forms.Label

Me.Label17 = New System.Windows.Forms.Label

Me.Label16 = New System.Windows.Forms.Label

Me.Label15 = New System.Windows.Forms.Label

Me.Label14 = New System.Windows.Forms.Label

Me.Label13 = New System.Windows.Forms.Label

Me.SqlProfileTable = New System.Data.SqlClient.SqlDataAdapter

Me.SqlSelectCommand3 = New System.Data.SqlClient.SqlCommand

Me.SqlSptFile = New System.Data.SqlClient.SqlDataAdapter

Me.SqlSelectCommand4 = New System.Data.SqlClient.SqlCommand

Me.SqlDataAdapter2 = New System.Data.SqlClient.SqlDataAdapter

Me.SqlSeland5 = New System.Data.SqlClient.SqlCommand

Me.SqlSelectCommand5 = New System.Data.SqlClient.SqlCommand

Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand

Me.SqlUpdateCommand2 = New System.Data.SqlClient.SqlCommand

Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand

Me.SqlDataAdapter3 = New System.Data.SqlClient.SqlDataAdapter

Me.sqlcountval = New System.Data.SqlClient.SqlCommand

Me.myPicArea = New System.Windows.Forms.PictureBox

Me.graphScaleArea = New System.Windows.Forms.PictureBox

Me.btnEnlarge = New System.Windows.Forms.Label

Me.Button1 = New System.Windows.Forms.Button

Me.PrintDialog1 = New System.Windows.Forms.PrintDialog

Me.PrintPreviewDialog1 = New System.Windows.Forms.PrintPreviewDialog

Me.Panel1.SuspendLayout()

Me.Panel2.SuspendLayout()

Me.Panel3.SuspendLayout()

Me.SuspendLayout()

'

'Panel1

'

Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Panel1.Controls.Add(Me.lblHeading)

Me.Panel1.Location = New System.Drawing.Point(184, 64)

Me.Panel1.Name = "Panel1"

Me.Panel1.Size = New System.Drawing.Size(560, 56)

Me.Panel1.TabIndex = 4

'

'lblHeading

'

Me.lblHeading.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.lblHeading.Location = New System.Drawing.Point(8, 8)

Me.lblHeading.Name = "lblHeading"

Me.lblHeading.Size = New System.Drawing.Size(544, 40)

Me.lblHeading.TabIndex = 0

Me.lblHeading.Text = "Log of Boring at Location(area) hole 2"

Me.lblHeading.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Panel2

'

Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Panel2.Controls.Add(Me.txtDrilling)

Me.Panel2.Controls.Add(Me.txtJobRefNo)

Me.Panel2.Controls.Add(Me.txtLogged)

Me.Panel2.Controls.Add(Me.txtSurvey)

Me.Panel2.Controls.Add(Me.txtEastCoord)

Me.Panel2.Controls.Add(Me.txtNorthcoord)

Me.Panel2.Controls.Add(Me.txtCompanyRep)

Me.Panel2.Controls.Add(Me.txtholeDia)

Me.Panel2.Controls.Add(Me.txtGwt)

Me.Panel2.Controls.Add(Me.txtGroundElev)

Me.Panel2.Controls.Add(Me.txtDateEnd)

Me.Panel2.Controls.Add(Me.txtDateStart)

Me.Panel2.Controls.Add(Me.lblGwt)

Me.Panel2.Controls.Add(Me.Label2)

Me.Panel2.Controls.Add(Me.Label1)

Me.Panel2.Controls.Add(Me.Label12)

Me.Panel2.Controls.Add(Me.Label11)

Me.Panel2.Controls.Add(Me.Label10)

Me.Panel2.Controls.Add(Me.Label9)

Me.Panel2.Controls.Add(Me.Label8)

Me.Panel2.Controls.Add(Me.Label6)

Me.Panel2.Controls.Add(Me.Label5)

Me.Panel2.Controls.Add(Me.Label4)

Me.Panel2.Controls.Add(Me.Label3)

Me.Panel2.Location = New System.Drawing.Point(184, 120)

Me.Panel2.Name = "Panel2"

Me.Panel2.Size = New System.Drawing.Size(560, 160)

Me.Panel2.TabIndex = 5

'

'txtDrilling

'

Me.txtDrilling.Location = New System.Drawing.Point(112, 80)

Me.txtDrilling.Name = "txtDrilling"

Me.txtDrilling.Size = New System.Drawing.Size(100, 20)

Me.txtDrilling.TabIndex = 38

'

'txtJobRefNo

'

Me.txtJobRefNo.Location = New System.Drawing.Point(400, 128)

Me.txtJobRefNo.Name = "txtJobRefNo"

Me.txtJobRefNo.Size = New System.Drawing.Size(100, 20)

Me.txtJobRefNo.TabIndex = 37

'

'txtLogged

'

Me.txtLogged.Location = New System.Drawing.Point(400, 104)

Me.txtLogged.Name = "txtLogged"

Me.txtLogged.Size = New System.Drawing.Size(100, 20)

Me.txtLogged.TabIndex = 36

'

'txtSurvey

'

Me.txtSurvey.Location = New System.Drawing.Point(400, 80)

Me.txtSurvey.Name = "txtSurvey"

Me.txtSurvey.Size = New System.Drawing.Size(100, 20)

Me.txtSurvey.TabIndex = 35

'

'txtEastCoord

'

Me.txtEastCoord.Location = New System.Drawing.Point(400, 56)

Me.txtEastCoord.Name = "txtEastCoord"

Me.txtEastCoord.Size = New System.Drawing.Size(100, 20)

Me.txtEastCoord.TabIndex = 34

'

'txtNorthcoord

'

Me.txtNorthcoord.Location = New System.Drawing.Point(400, 32)

Me.txtNorthcoord.Name = "txtNorthcoord"

Me.txtNorthcoord.Size = New System.Drawing.Size(100, 20)

Me.txtNorthcoord.TabIndex = 33

'

'txtCompanyRep

'

Me.txtCompanyRep.Location = New System.Drawing.Point(400, 8)

Me.txtCompanyRep.Name = "txtCompanyRep"

Me.txtCompanyRep.Size = New System.Drawing.Size(100, 20)

Me.txtCompanyRep.TabIndex = 32

'

'txtholeDia

'

Me.txtholeDia.Location = New System.Drawing.Point(112, 56)

Me.txtholeDia.Name = "txtholeDia"

Me.txtholeDia.Size = New System.Drawing.Size(100, 20)

Me.txtholeDia.TabIndex = 31

'

'txtGwt

'

Me.txtGwt.Location = New System.Drawing.Point(112, 128)

Me.txtGwt.Name = "txtGwt"

Me.txtGwt.Size = New System.Drawing.Size(100, 20)

Me.txtGwt.TabIndex = 30

'

'txtGroundElev

'

Me.txtGroundElev.Location = New System.Drawing.Point(112, 104)

Me.txtGroundElev.Name = "txtGroundElev"

Me.txtGroundElev.Size = New System.Drawing.Size(100, 20)

Me.txtGroundElev.TabIndex = 29

'

'txtDateEnd

'

Me.txtDateEnd.Location = New System.Drawing.Point(112, 32)

Me.txtDateEnd.Name = "txtDateEnd"

Me.txtDateEnd.Size = New System.Drawing.Size(100, 20)

Me.txtDateEnd.TabIndex = 28

'

'txtDateStart

'

Me.txtDateStart.Location = New System.Drawing.Point(112, 8)

Me.txtDateStart.Name = "txtDateStart"

Me.txtDateStart.Size = New System.Drawing.Size(100, 20)

Me.txtDateStart.TabIndex = 27

'

'lblGwt

'

Me.lblGwt.Location = New System.Drawing.Point(8, 128)

Me.lblGwt.Name = "lblGwt"

Me.lblGwt.Size = New System.Drawing.Size(100, 20)

Me.lblGwt.TabIndex = 26

Me.lblGwt.Text = "GWT"

'

'Label2

'

Me.Label2.Location = New System.Drawing.Point(8, 104)

Me.Label2.Name = "Label2"

Me.Label2.Size = New System.Drawing.Size(100, 20)

Me.Label2.TabIndex = 24

Me.Label2.Text = "Ground Elev"

'

'Label1

'

Me.Label1.Location = New System.Drawing.Point(288, 128)

Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing.Size(100, 20)

Me.Label1.TabIndex = 23

Me.Label1.Text = "Job Ref #"

'

'Label12

'

Me.Label12.Location = New System.Drawing.Point(288, 104)

Me.Label12.Name = "Label12"

Me.Label12.Size = New System.Drawing.Size(100, 20)

Me.Label12.TabIndex = 14

Me.Label12.Text = "Logged By"

'

'Label11

'

Me.Label11.Location = New System.Drawing.Point(288, 80)

Me.Label11.Name = "Label11"

Me.Label11.Size = New System.Drawing.Size(100, 20)

Me.Label11.TabIndex = 13

Me.Label11.Text = "Survey By"

'

'Label10

'

Me.Label10.Location = New System.Drawing.Point(288, 56)

Me.Label10.Name = "Label10"

Me.Label10.Size = New System.Drawing.Size(100, 20)

Me.Label10.TabIndex = 12

Me.Label10.Text = "Easting Coord"

'

'Label9

'

Me.Label9.Location = New System.Drawing.Point(288, 32)

Me.Label9.Name = "Label9"

Me.Label9.Size = New System.Drawing.Size(100, 20)

Me.Label9.TabIndex = 11

Me.Label9.Text = "Northing Coord"

'

'Label8

'

Me.Label8.Location = New System.Drawing.Point(288, 8)

Me.Label8.Name = "Label8"

Me.Label8.Size = New System.Drawing.Size(100, 20)

Me.Label8.TabIndex = 10

Me.Label8.Text = "Company Rep"

'

'Label6

'

Me.Label6.Location = New System.Drawing.Point(8, 80)

Me.Label6.Name = "Label6"

Me.Label6.Size = New System.Drawing.Size(100, 20)

Me.Label6.TabIndex = 4

Me.Label6.Text = "Drilling Method"

'

'Label5

'

Me.Label5.Location = New System.Drawing.Point(8, 32)

Me.Label5.Name = "Label5"

Me.Label5.Size = New System.Drawing.Size(100, 20)

Me.Label5.TabIndex = 3

Me.Label5.Text = "Date Completed"

'

'Label4

'

Me.Label4.Location = New System.Drawing.Point(8, 56)

Me.Label4.Name = "Label4"

Me.Label4.Size = New System.Drawing.Size(100, 20)

Me.Label4.TabIndex = 2

Me.Label4.Text = "Hole Diameter"

'

'Label3

'

Me.Label3.Location = New System.Drawing.Point(8, 8)

Me.Label3.Name = "Label3"

Me.Label3.Size = New System.Drawing.Size(100, 20)

Me.Label3.TabIndex = 0

Me.Label3.Text = "Date Started"

'

'Panel3

'

Me.Panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Panel3.Controls.Add(Me.lblCompany)

Me.Panel3.Controls.Add(Me.lblName)

Me.Panel3.Controls.Add(Me.PictureBox1)

Me.Panel3.Controls.Add(Me.Label7)

Me.Panel3.Location = New System.Drawing.Point(24, 64)

Me.Panel3.Name = "Panel3"

Me.Panel3.Size = New System.Drawing.Size(160, 216)

Me.Panel3.TabIndex = 6

'

'lblCompany

'

Me.lblCompany.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.lblCompany.Location = New System.Drawing.Point(12, 148)

Me.lblCompany.Name = "lblCompany"

Me.lblCompany.Size = New System.Drawing.Size(136, 23)

Me.lblCompany.TabIndex = 5

Me.lblCompany.Text = "Company Name"

'

'lblName

'

Me.lblName.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.lblName.Location = New System.Drawing.Point(12, 118)

Me.lblName.Name = "lblName"

Me.lblName.Size = New System.Drawing.Size(136, 23)

Me.lblName.TabIndex = 4

Me.lblName.Text = "Client Name"

'

'PictureBox1

'

Me.PictureBox1.Location = New System.Drawing.Point(12, 9)

Me.PictureBox1.Name = "PictureBox1"

Me.PictureBox1.Size = New System.Drawing.Size(136, 95)

Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage

Me.PictureBox1.TabIndex = 3

Me.PictureBox1.TabStop = False

'

'Label7

'

Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label7.Location = New System.Drawing.Point(12, 178)

Me.Label7.Name = "Label7"

Me.Label7.Size = New System.Drawing.Size(136, 23)

Me.Label7.TabIndex = 1

'

'SqlAdapter1

'

Me.SqlAdapter1.SelectCommand = Me.SqlSelectCommand1

Me.SqlAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "boreHole", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("clientName", "clientName"), New System.Data.Common.DataColumnMapping("companyName", "companyName"), New System.Data.Common.DataColumnMapping("lcationName", "lcationName"), New System.Data.Common.DataColumnMapping("area", "area"), New System.Data.Common.DataColumnMapping("boreHoleNo", "boreHoleNo")})})

Me.SqlAdapter1.UpdateCommand = Me.SqlUpdateCommand1

'

'SqlSelectCommand1

'

Me.SqlSelectCommand1.CommandText = "SELECT clients.clientName, clients.companyName, location.lcationName, location.ar" & _

"ea, boreHole.boreHoleNo, boreHole.boreHoleId, clients.clientId, location.locatio" & _

"nId FROM boreHole INNER JOIN location ON boreHole.locationId = location.location" & _

"Id INNER JOIN clients ON location.clientId = clients.clientId WHERE (boreHole.bo" & _

"reHoleId = @holeIDw)"

Me.SqlSelectCommand1.Connection = Me.SqlConnection1

Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@holeIDw", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Current, Nothing))

'

'SqlUpdateCommand1

'

Me.SqlUpdateCommand1.CommandText = "UPDATE boreHole SET dateStarted = @dateStart, dateCompleted = @dateEnd, holeDiame" & _

"ter = @holeDiam, groundElev = @groundElev, drillingId = @DrillingId, companyRep " & _

"= @comprep, northCoord = @north, eastCoord = @east, surveyBy = @survey, loggedBy" & _

" = @logged, jobRefNo = @jobref, gwtDepth = @Gwtdep WHERE (boreHoleId = @bHoleId)" & _

""

Me.SqlUpdateCommand1.Connection = Me.SqlConnection1

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@dateStart", System.Data.SqlDbType.VarChar, 10, "dateStarted"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@dateEnd", System.Data.SqlDbType.VarChar, 10, "dateCompleted"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@holeDiam", System.Data.SqlDbType.Float, 8, "holeDiameter"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@groundElev", System.Data.SqlDbType.Float, 8, "groundElev"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@DrillingId", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "drillingId", System.Data.DataRowVersion.Current, Nothing))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@comprep", System.Data.SqlDbType.VarChar, 30, "companyRep"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@north", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "northCoord", System.Data.DataRowVersion.Current, Nothing))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@east", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "eastCoord", System.Data.DataRowVersion.Current, Nothing))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@survey", System.Data.SqlDbType.VarChar, 30, "surveyBy"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@logged", System.Data.SqlDbType.VarChar, 30, "loggedBy"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@jobref", System.Data.SqlDbType.VarChar, 15, "jobRefNo"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Gwtdep", System.Data.SqlDbType.Float, 8, "gwtDepth"))

Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@bHoleId", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Original, Nothing))

'

'SqlDataAdapter1

'

Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand2

Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "boreHole", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("dateStarted", "dateStarted"), New System.Data.Common.DataColumnMapping("dateCompleted", "dateCompleted"), New System.Data.Common.DataColumnMapping("holeDiameter", "holeDiameter"), New System.Data.Common.DataColumnMapping("groundElev", "groundElev"), New System.Data.Common.DataColumnMapping("drillingId", "drillingId"), New System.Data.Common.DataColumnMapping("companyRep", "companyRep"), New System.Data.Common.DataColumnMapping("northCoord", "northCoord"), New System.Data.Common.DataColumnMapping("eastCoord", "eastCoord"), New System.Data.Common.DataColumnMapping("surveyBy", "surveyBy"), New System.Data.Common.DataColumnMapping("loggedBy", "loggedBy"), New System.Data.Common.DataColumnMapping("jobRefNo", "jobRefNo")})})

'

'SqlSelectCommand2

'

Me.SqlSelectCommand2.CommandText = "SELECT boreHole.dateStarted, boreHole.dateCompleted, boreHole.holeDiameter, boreH" & _

"ole.groundElev, drilling.drillingMethod, boreHole.companyRep, boreHole.northCoor" & _

"d, boreHole.eastCoord, boreHole.surveyBy, boreHole.loggedBy, boreHole.jobRefNo, " & _

"boreHole.gwtDepth FROM boreHole INNER JOIN drilling ON boreHole.drillingId = dri" & _

"lling.drillingId WHERE (boreHole.boreHoleId = @holeIt)"

Me.SqlSelectCommand2.Connection = Me.SqlConnection1

Me.SqlSelectCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@holeIt", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Current, Nothing))

'

'Label25

'

Me.Label25.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label25.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label25.Location = New System.Drawing.Point(508, 311)

Me.Label25.Name = "Label25"

Me.Label25.Size = New System.Drawing.Size(48, 33)

Me.Label25.TabIndex = 48

Me.Label25.Text = "N value"

Me.Label25.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label23

'

Me.Label23.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label23.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label23.Location = New System.Drawing.Point(461, 311)

Me.Label23.Name = "Label23"

Me.Label23.Size = New System.Drawing.Size(48, 33)

Me.Label23.TabIndex = 47

Me.Label23.Text = "6"""

Me.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label18

'

Me.Label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label18.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label18.Location = New System.Drawing.Point(414, 311)

Me.Label18.Name = "Label18"

Me.Label18.Size = New System.Drawing.Size(48, 33)

Me.Label18.TabIndex = 46

Me.Label18.Text = "6"""

Me.Label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label24

'

Me.Label24.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label24.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label24.Location = New System.Drawing.Point(367, 311)

Me.Label24.Name = "Label24"

Me.Label24.Size = New System.Drawing.Size(48, 33)

Me.Label24.TabIndex = 45

Me.Label24.Text = "6"""

Me.Label24.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label22

'

Me.Label22.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label22.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label22.Location = New System.Drawing.Point(555, 296)

Me.Label22.Name = "Label22"

Me.Label22.Size = New System.Drawing.Size(190, 48)

Me.Label22.TabIndex = 44

Me.Label22.Text = "Sample Graph"

Me.Label22.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label17

'

Me.Label17.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label17.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label17.Location = New System.Drawing.Point(367, 296)

Me.Label17.Name = "Label17"

Me.Label17.Size = New System.Drawing.Size(189, 16)

Me.Label17.TabIndex = 43

Me.Label17.Text = "SPT BLOWS"

Me.Label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label16

'

Me.Label16.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label16.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label16.Location = New System.Drawing.Point(317, 296)

Me.Label16.Name = "Label16"

Me.Label16.Size = New System.Drawing.Size(51, 48)

Me.Label16.TabIndex = 42

Me.Label16.Text = "Group Symbol"

Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label15

'

Me.Label15.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label15.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label15.Location = New System.Drawing.Point(126, 296)

Me.Label15.Name = "Label15"

Me.Label15.Size = New System.Drawing.Size(192, 48)

Me.Label15.TabIndex = 41

Me.Label15.Text = "Description of Material"

Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label14

'

Me.Label14.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label14.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label14.Location = New System.Drawing.Point(71, 296)

Me.Label14.Name = "Label14"

Me.Label14.Size = New System.Drawing.Size(56, 48)

Me.Label14.TabIndex = 40

Me.Label14.Text = "Sample No"

Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Label13

'

Me.Label13.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.Label13.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label13.Location = New System.Drawing.Point(24, 296)

Me.Label13.Name = "Label13"

Me.Label13.Size = New System.Drawing.Size(48, 48)

Me.Label13.TabIndex = 39

Me.Label13.Text = "Depth (meter)"

Me.Label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'SqlProfileTable

'

Me.SqlProfileTable.SelectCommand = Me.SqlSelectCommand3

Me.SqlProfileTable.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "material", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("soilProfile", "soilProfile"), New System.Data.Common.DataColumnMapping("startdepth", "startdepth"), New System.Data.Common.DataColumnMapping("enddepth", "enddepth"), New System.Data.Common.DataColumnMapping("materialColor", "materialColor"), New System.Data.Common.DataColumnMapping("materialImage", "materialImage")})})

'

'SqlSelectCommand3

'

Me.SqlSelectCommand3.CommandText = "SELECT soilProfile, depth, materialImage, materialColor, line FROM profile WHERE " & _

"(boreHoleId = @boreHoleId)"

Me.SqlSelectCommand3.Connection = Me.SqlConnection1

Me.SqlSelectCommand3.Parameters.Add(New System.Data.SqlClient.SqlParameter("@boreHoleId", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Current, Nothing))

'

'SqlSptFile

'

Me.SqlSptFile.SelectCommand = Me.SqlSelectCommand4

Me.SqlSptFile.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "spt", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("sampleMethod", "sampleMethod"), New System.Data.Common.DataColumnMapping("sptBlast1", "sptBlast1"), New System.Data.Common.DataColumnMapping("sptBlast2", "sptBlast2"), New System.Data.Common.DataColumnMapping("sptBlast3", "sptBlast3"), New System.Data.Common.DataColumnMapping("nVal", "nVal")})})

'

'SqlSelectCommand4

'

Me.SqlSelectCommand4.CommandText = "SELECT sampleMethod, sptBlast1, sptBlast2, sptBlast3, nVal, sptId FROM spt WHERE " & _

"(boreHoleId = @sptTable)"

Me.SqlSelectCommand4.Connection = Me.SqlConnection1

Me.SqlSelectCommand4.Parameters.Add(New System.Data.SqlClient.SqlParameter("@sptTable", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Current, Nothing))

'

'SqlDataAdapter2

'

Me.SqlDataAdapter2.SelectCommand = Me.SqlSeland5

Me.SqlDataAdapter2.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "spt", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("nVal", "nVal")})})

'

'SqlSeland5

'

Me.SqlSeland5.CommandText = "SELECT nVal, sptId FROM spt WHERE (boreHoleId = @HoleIdfor)"

Me.SqlSeland5.Connection = Me.SqlConnection1

Me.SqlSeland5.Parameters.Add(New System.Data.SqlClient.SqlParameter("@HoleIdfor", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Current, Nothing))

'

'SqlDataAdapter3

'

Me.SqlDataAdapter3.DeleteCommand = Me.SqlDeleteCommand1

Me.SqlDataAdapter3.InsertCommand = Me.SqlInsertCommand1

Me.SqlDataAdapter3.SelectCommand = Me.SqlSelectCommand5

Me.SqlDataAdapter3.UpdateCommand = Me.SqlUpdateCommand2

'

'sqlcountval

'

Me.sqlcountval.CommandText = "SELECT COUNT(nVal) AS Expr1 FROM spt WHERE (boreHoleId = @countID)"

Me.sqlcountval.Connection = Me.SqlConnection1

Me.sqlcountval.Parameters.Add(New System.Data.SqlClient.SqlParameter("@countID", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "boreHoleId", System.Data.DataRowVersion.Current, Nothing))

'

'myPicArea

'

Me.myPicArea.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.myPicArea.Location = New System.Drawing.Point(559, 350)

Me.myPicArea.Name = "myPicArea"

Me.myPicArea.Size = New System.Drawing.Size(183, 72)

Me.myPicArea.TabIndex = 50

Me.myPicArea.TabStop = False

Me.myPicArea.Visible = False

'

'graphScaleArea

'

Me.graphScaleArea.BackgroundImage = CType(resources.GetObject("graphScaleArea.BackgroundImage"), System.Drawing.Image)

Me.graphScaleArea.Location = New System.Drawing.Point(560, 350)

Me.graphScaleArea.Name = "graphScaleArea"

Me.graphScaleArea.Size = New System.Drawing.Size(182, 12)

Me.graphScaleArea.TabIndex = 51

Me.graphScaleArea.TabStop = False

Me.graphScaleArea.Visible = False

'

'btnEnlarge

'

Me.btnEnlarge.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

Me.btnEnlarge.FlatStyle = System.Windows.Forms.FlatStyle.Flat

Me.btnEnlarge.Location = New System.Drawing.Point(562, 403)

Me.btnEnlarge.Name = "btnEnlarge"

Me.btnEnlarge.Size = New System.Drawing.Size(177, 16)

Me.btnEnlarge.TabIndex = 52

Me.btnEnlarge.Text = "Enlarge"

Me.btnEnlarge.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

'

'Button1

'

Me.Button1.Location = New System.Drawing.Point(184, 16)

Me.Button1.Name = "Button1"

Me.Button1.TabIndex = 53

Me.Button1.Text = "B&utton1"

'

'PrintPreviewDialog1

'

Me.PrintPreviewDialog1.AutoScrollMargin = New System.Drawing.Size(0, 0)

Me.PrintPreviewDialog1.AutoScrollMinSize = New System.Drawing.Size(0, 0)

Me.PrintPreviewDialog1.ClientSize = New System.Drawing.Size(400, 300)

Me.PrintPreviewDialog1.Enabled = True

Me.PrintPreviewDialog1.Icon = CType(resources.GetObject("PrintPreviewDialog1.Icon"), System.Drawing.Icon)

Me.PrintPreviewDialog1.Location = New System.Drawing.Point(354, 63)

Me.PrintPreviewDialog1.MinimumSize = New System.Drawing.Size(375, 250)

Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"

Me.PrintPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty

Me.PrintPreviewDialog1.Visible = False

'

'report

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.AutoScroll = True

Me.BackColor = System.Drawing.SystemColors.Window

Me.ClientSize = New System.Drawing.Size(770, 446)

Me.Controls.Add(Me.Button1)

Me.Controls.Add(Me.btnEnlarge)

Me.Controls.Add(Me.graphScaleArea)

Me.Controls.Add(Me.myPicArea)

Me.Controls.Add(Me.Label25)

Me.Controls.Add(Me.Label23)

Me.Controls.Add(Me.Label18)

Me.Controls.Add(Me.Label24)

Me.Controls.Add(Me.Label22)

Me.Controls.Add(Me.Label17)

Me.Controls.Add(Me.Label16)

Me.Controls.Add(Me.Label15)

Me.Controls.Add(Me.Label14)

Me.Controls.Add(Me.Label13)

Me.Controls.Add(Me.Panel3)

Me.Controls.Add(Me.Panel2)

Me.Controls.Add(Me.Panel1)

Me.Name = "report"

Me.Text = "report"

Me.WindowState = System.Windows.Forms.FormWindowState.Maximized

Me.Panel1.ResumeLayout(False)

Me.Panel2.ResumeLayout(False)

Me.Panel3.ResumeLayout(False)

Me.ResumeLayout(False)

End Sub

#End Region

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

Dim myImg As New PictureBox

Dim arrParam As String = ""

Dim regKey As RegistryKey, regSubKey As RegistryKey

regKey = Registry.CurrentUser

regSubKey = regKey.CreateSubKey("Software")

regSubKey = regSubKey.CreateSubKey("BoreLog")

Try

Me.SqlConnection1.ConnectionString = regSubKey.GetValue("StrConn").ToString

Me.imgLocation = regSubKey.GetValue("imageLoc").ToString

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

Me.SqlConnection1.Open()

Dim sqlRdr1 As SqlDataReader

Me.sqlcountval.Parameters(0).Value = holeIdq

sqlRdr1 =
Me.sqlcountval.ExecuteReader()

While sqlRdr1.Read

countRec =
CType(sqlRdr1.Item(0), Integer)

End While

Me.SqlConnection1.Close()

Me.PictureBox1.Image = Image.FromFile(Me.imgLocation & "\logo.bmp")

'Load top information

loadClientInfo(holeIdq)

load_holeData()

'Load Report data

arrParam = methodIdea(holeIdq)

mySplit(arrParam)

'Draw the depth scale

drawScale()

'GWT Line

picarea(20, (CInt(CType(Me.txtGwt.Text, Double) * 40)) + 350, 39, 8, Me.imgLocation & "\gwt.bmp", "0", myImg)

'Load Array of values to draw graph

loadArr()

'btnEnlarde

Me.btnEnlarge.SetBounds(562, 350 + Me.myPicArea.Height - 19, 177, 16)

Me.Finalize()

End Sub

Private Sub drawScale()

Dim i As Integer = 0

Try

For i = 0 To countRec

Dim myLabel As New Label

myLabel.Text = i.ToString

myLabel.BorderStyle = BorderStyle.None

myLabel.SetBounds(35, 345 + (40 * i), 17, 13)

Me.Controls.Add(myLabel)

Next

Catch ex As Exception

MessageBox.Show(ex.ToString)

End Try

End Sub

Private Sub mySplit(ByVal maParam As String)

Try

While maParam.Length > 0

Dim myImg As New PictureBox

Dim myY As Integer = CInt(maParam.Substring(0, maParam.IndexOf("|")))

maParam = maParam.Remove(0, maParam.IndexOf("|") + 1)

picarea(126, myY - 1, 242, 2,
Me.imgLocation & "\line.bmp", "0", myImg)

End While

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End Sub

Public Function methodIdea(ByVal holes As String) As String

Dim x As Integer = 0

Dim y As Integer = 0

Dim arrParam As String = ""

Dim myY As Integer = 350

Dim myI As Integer = 1

Me.SqlConnection1.Open()

Dim sqlRdr As SqlDataReader

Me.SqlSelectCommand3.Parameters(0).Value = holes

sqlRdr =
Me.SqlSelectCommand3.ExecuteReader()

Dim j As Integer = 0

Try

While sqlRdr.Read

Dim w As New Label

Dim img As New PictureBox

x += y

y =
CInt(CType(sqlRdr.Item(1), Double) * 41)

If myI = 1 Then

y = y - myI

Else

y -= (myI + 1)

End If

labelarea(126, myY + x, 192, y, sqlRdr.Item(0).ToString, w)

picarea(312, myY + x, 56, y,
Me.imgLocation & "\" & sqlRdr.Item(2).ToString().Trim() & ".bmp", sqlRdr.Item(3).ToString, img)

If CInt(sqlRdr.Item(4)) = 1 Then

arrParam &= myY + x + y & "|"

End If

myY -= myI

myI += 1

End While

Catch erroronprofile As Exception

MessageBox.Show(erroronprofile.ToString)

End Try

Me.SqlConnection1.Close()

'***********************************************************************

'***********************************************************************

'***********************************************************************

Me.SqlConnection1.Open()

x = 0

y = 41

myY = 350

Dim sqlRdr1 As SqlDataReader

Dim lab As String

Me.SqlSelectCommand4.Parameters(0).Value = holes

sqlRdr1 =
Me.SqlSelectCommand4.ExecuteReader()

Try

While sqlRdr1.Read

Dim w As New Label

Dim w1 As New Label

Dim w2 As New Label

Dim w3 As New Label

Dim w4 As New Label

labelarea(71, myY + x, 56, y, sqlRdr1.Item(0).ToString, w)

labelarea(367, myY + x, 48, y, sqlRdr1.Item(1).ToString, w1)

labelarea(414, myY + x, 48, y, sqlRdr1.Item(2).ToString, w2)

labelarea(461, myY + x, 48, y, sqlRdr1.Item(3).ToString, w3)

labelarea(508, myY + x, 48, y, sqlRdr1.Item(4).ToString, w4)

myY -= 1

x += 41

End While

Catch erroronprofile1 As Exception

MessageBox.Show(erroronprofile1.ToString)

End Try

Me.SqlConnection1.Close()

Dim i As Integer = 0

For i = 0 To countRec - 1

Dim myImg As New PictureBox

picarea(56, 350 + (40 * i), 14, 40,
Me.imgLocation & "\scale.bmp", "-10", myImg)

Next

Return arrParam

End Function

Public Sub load_holeData()

Me.SqlConnection1.Open()

Dim sqlRdr As SqlDataReader

Me.SqlSelectCommand2.Parameters(0).Value = holeIdq

sqlRdr =
Me.SqlSelectCommand2.ExecuteReader()

Try

While sqlRdr.Read

Me.txtDateStart.Text = sqlRdr.Item(0).ToString

Me.txtDateEnd.Text = sqlRdr.Item(1).ToString

Me.txtholeDia.Text = sqlRdr.Item(2).ToString

Me.txtGroundElev.Text = sqlRdr.Item(3).ToString

Me.txtDrilling.Text = sqlRdr.Item(4).ToString

Me.txtGwt.Text = sqlRdr.Item(11).ToString

Me.txtCompanyRep.Text = sqlRdr.Item(5).ToString

Me.txtNorthcoord.Text = sqlRdr.Item(6).ToString

Me.txtEastCoord.Text = sqlRdr.Item(7).ToString

Me.txtSurvey.Text = sqlRdr.Item(8).ToString

Me.txtLogged.Text = sqlRdr.Item(9).ToString

Me.txtJobRefNo.Text = sqlRdr.Item(10).ToString

End While

Catch erroronInsert As Exception

End Try

Me.SqlConnection1.Close()

End Sub

Private Sub loadClientInfo(ByVal hole As String)

Try

Me.SqlConnection1.Open()

Dim sqlReader As SqlDataReader

Me.SqlSelectCommand1.Parameters(0).Value = holeIdq

sqlReader =
Me.SqlSelectCommand1.ExecuteReader()

While sqlReader.Read

Me.lblName.Text = "Name: " & sqlReader.Item(0).ToString

Me.lblCompany.Text = "Company: " & sqlReader.Item(1).ToString

Me.lblHeading.Text = "Log of Boring at " & sqlReader.Item(2).ToString.TrimEnd & "(" & sqlReader.Item(3).ToString.TrimEnd & ")"

Me.Label7.Text = "Hole No.: " & sqlReader.Item(4).ToString.TrimEnd

End While

Catch werrty As Exception

MessageBox.Show(werrty.ToString)

End Try

Me.SqlConnection1.Close()

End Sub

Public Sub labelarea(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal textValue As String, ByVal labels As Label)

labels.Location =
New System.Drawing.Point(x, y)

labels.Name = "Label1"

labels.Size =
New System.Drawing.Size(width, height)

labels.BorderStyle = BorderStyle.FixedSingle

labels.Text = textValue

labels.TextAlign = ContentAlignment.MiddleCenter

Me.Controls.Add(labels)

End Sub

Public Sub picarea(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal img As String, ByVal colour As String, ByVal PeBox2 As PictureBox)

Dim c1 As Color = Color.Black

Dim myImg As Image = Image.FromFile(img)

Dim bm As New Bitmap(myImg)

Dim eX As Integer

Dim eY As Integer

If (CInt(colour) <> 0 And CInt(colour) <> -10) Then

For eX = 0 To bm.Width - 1

For eY = 0 To bm.Height - 1

If bm.GetPixel(eX, eY).ToArgb = c1.ToArgb() Then

bm.SetPixel(eX, eY, Color.FromArgb(CInt(colour)))

End If

Next eY

Next eX

End If

PeBox2.Image = bm

PeBox2.Location =
New System.Drawing.Point(x, y)

PeBox2.Size =
New System.Drawing.Size(width, height)

PeBox2.BorderStyle = BorderStyle.FixedSingle

PeBox2.Name = "PeBox2"

PeBox2.TabStop =
False

If CInt(colour) = 0 Then

PeBox2.BorderStyle = BorderStyle.None

PeBox2.SizeMode = PictureBoxSizeMode.CenterImage

Else

If CInt(colour) = -10 Then

PeBox2.BorderStyle = BorderStyle.None

PeBox2.SizeMode = PictureBoxSizeMode.AutoSize

Else

PeBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage

End If

End If

Me.Controls.Add(PeBox2)

If CInt(colour) = 0 Then

Me.Controls.Item(Me.Controls.Count() - 1).BringToFront()

End If

End Sub

Private Sub loadArr()

Dim i As Integer = 0

Dim sqlRdr As SqlDataReader

Dim arrGraph(countRec) As Double

Me.SqlConnection1.Open()

Me.SqlSeland5.Parameters(0).Value = holeIdq

sqlRdr =
Me.SqlSeland5.ExecuteReader()

Try

While sqlRdr.Read

arrGraph(i) =
CType(sqlRdr.Item(0), Integer)

i += 1

End While

Catch erroronInsert As Exception

MessageBox.Show(erroronInsert.ToString)

End Try

Me.SqlConnection1.Close()

drawGraph(arrGraph)

End Sub

Public Sub drawGraph(ByVal arrGraph() As Double)

Me.myPicArea.SetBounds(559, 350, 183, 40 * countRec)

Me.graphScaleArea.Visible = True

Me.Controls.Add(Me.graphScaleArea)

Dim bm As Bitmap = New Bitmap(Me.myPicArea.Width, Me.myPicArea.Height)

Dim g As Graphics = Graphics.FromImage(bm)

Dim i As Integer = 0

Dim x As Integer = 0

Dim y As Integer = 0

For i = 0 To (countRec - 1)

g.DrawLine(Pens.Black, x, y,
CInt(arrGraph(i) * 3), y + 40)

x =
CInt(arrGraph(i) * 3)

y += 40

Next

Me.myPicArea.Image = bm

Me.myPicArea.Visible = True

Me.Controls.Add(Me.myPicArea)

'clean up resources

g.Dispose()

End Sub

Private Sub btnEnlarge_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEnlarge.Click

Dim objGraph As New graphBig(holeIdq)

objGraph.ShowDialog(
Me)

End Sub

Friend WithEvents prntDoc As New PrintDocument

Private Print_Image As Image

Declare Auto Function BitBlt Lib "GDI32.DLL" ( _

ByVal hdcDest As IntPtr, _

ByVal nXDest As Integer, _

ByVal nYDest As Integer, _

ByVal nWidth As Integer, _

ByVal nHeight As Integer, _

ByVal hdcSrc As IntPtr, _

ByVal nXSrc As Integer, _

ByVal nYSrc As Integer, _

ByVal dwRop As Int32) As Boolean

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Console.WriteLine("Height: " &
Me.Height)

Console.WriteLine("Width: " &
Me.Width)

Dim prnDialog As New PrintDialog

'Get a Graphics Object from the form

Dim FormG As Graphics = Me.CreateGraphics

'Create a bitmap from that graphics

Dim i As New Bitmap(Me.Width, Me.Height, FormG)

'Create a Graphics object in memory from that bitmap

Dim memG As Graphics = Graphics.FromImage(i)

'get the IntPtr's of the graphics

Dim HDC1 As IntPtr = FormG.GetHdc

Dim HDC2 As IntPtr = memG.GetHdc

'get the picture

BitBlt(HDC2, 0, 0, Me.ClientRectangle.Width, Me.ClientRectangle.Height, HDC1, 0, 0, 13369376)

'Clone the bitmap so we can dispose this one

Me.Print_Image = CType(i.Clone(), Image)

'Clean Up

FormG.ReleaseHdc(HDC1)

memG.ReleaseHdc(HDC2)

FormG.Dispose()

memG.Dispose()

i.Dispose()

' Give user opportunity to confirm (optional)

prnDialog.Document = prntDoc

Dim r As DialogResult = prnDialog.ShowDialog

If r = DialogResult.OK Then

prntDoc.Print()
End If
End Sub

Private Sub prntDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles prntDoc.PrintPage

e.Graphics.DrawImage(Print_Image, 0, 0)

End Sub



End Class

 
Well I wouldn't just pass 1 big image, try to split everything up. Ie :
e.Graphics.DrawImage(Graph, 0, 0)
e.Graphics.DrawString(Labes, 50, 50)
etc

Also if it's going to be more than 1 page you'll need to measure the sizes of things and use: e.hasmorepages = true/false. Otherwise you'll only ever get the 1 page.

Hope that helps

TPM
 
well its a bit hard for me to break the printing into pages because i cant find any sparameters that would help me when i paas the me.graphics to image

im attachin an image, this might give u an idea what my report looks like and how to print it
plz tell me if u get it.
 

Attachments

  • report.zip
    27.3 KB · Views: 80
I still can't open it.. :S Paszt made a post about this problem. Just post the image(ie don't zip it up)
 
I have winzip 9 and winrar already. winzip say's it's corrupt, winrar unzips it but I can't open the file(it's corrupt)
 
I'm also having the same problem. I've had this problem on this site before, it just seemed to start working again without me doing anything last time.
I'd hate to have to reformat each time this happens.
I'll go with just not downloading for now :)

Anyway...

I would suggest using Crystal Reports or some other suite designed for printing reports.
 
Last edited:
Nah I don't think it's windows, I tried it on 2 machines and they both wont open it. It's probably like you said in the other post, something to do with IE.

Crystal Reports is a good idea, it can be a bit of a pain though.
 
instead of zippin it ihave added y image to the word file you guyz must be able to see it now. plz look at it n tell me what to do.
 

Attachments

  • report.doc
    47 KB · Views: 57

Latest posts

Back
Top