Archive for February, 2009

Set the Default Paper Size for a Document to Legal with

Good Morning! Well it was a pretty quiet week. I had a lot of work related things to do so that is what I pretty much did. My daughter has been released to huber so that has got us all in an uproar as she needs many things. It will be interesting to see how this turns out. I pray for her daily despite everything that has happened.

Today’s topic is one that confounds many programmers. The PrintDocument object! Yes I can hear the snarling and gnashing of teeth going on out there. What we want to do is make the PrintDocument object follow our orders to make the document of legal size. If you have any experience with this you know this is not an easy task! Don’t forget if your printer does not support legal paper size (it happens) this will not work. Anyway, make it a great day!

Dim storedPageSettings As PageSettings = New PageSettings()
        Dim PSize As PaperSize = Nothing
        For Each PaperSizeContained As PaperSize In PrintDocument1.PrinterSettings.PaperSizes
            If (PaperSizeContained.RawKind = Printing.PaperKind.Legal) Then
                PSize = PaperSizeContained
                Exit For
            End If
        Next PaperSizeContained
        If (PSize Is Nothing) Then
            Throw New Exception("Oops! Can’t find Legal paper for this printer.")
        End If
        storedPageSettings.PaperSize = PSize    ‘<– this is the issue
        storedPageSettings.Landscape = True
        Dim dlg As New PrintPreviewDialog()
        PrintDocument1.DefaultPageSettings = storedPageSettings
        dlg.Document = PrintDocument1

Technorati Tags: ,,,,,,,,,,,,,

Leave a comment

Because of what I’ve done I don’t deserve to serve God publicly

If you can make this statement I will tell you I agree with you – but not for the reasons you might think.

You as a Christian who has served God in front of others have gone and done something that you know is wrong. You’ve probably shamed yourself, perhaps your family, community and church, and feel that God must be ashamed of you as well. God feels distant, and perhaps you are not even bothering to reach out to him. Your depressed, anxious and afraid. You might be afraid others in your church might find out.

What is wrong with this picture? In short everything.

The first mistake was for you to assume your service to God was about you. It was not. It’s about him. Perhaps this might be at the root of your issues. When the focus is on yourself instead of the one you are serving, you are bound to fail.

The next mistake was that you have fallen prey to the disease of shame. Not all shame is bad mind you, but this kind of shame consists of self loathing, self pitying and self punishment. (Did you catch the common word of self in there?) This kind of shame generates depression, anxiety and fear and is spiritually deadly, and can be physically harmful. We would never attribute those characteristics to God would we? This is how we know we are not in the will of God as what we are doing we know God would not desire us to be here. This you can take all the credit for in the world because you have forgotten five things:

1. He is God. You are not.  You are worrying about what you have done and what others in your church, family and community will think even though you have no chance of actually affecting any of it by obsessing on this. It is a vicious circle. The more you worry, the more miserable you become.

2. By doing this, you have taken God off the throne of your life and have put yourself there. Is God not to be trusted now, just because you have done something wrong? Did God change? The truth is your shame over what you have done is preventing you from turning it over to God and letting him handle these things. God loves you and is wanting this to happen for you.

3. You are not alone. We all have fallen at various times. I say this to make you feel better but to also as further evidence that your service to God has been about you and not him. Otherwise why would it matter?

4. God’s call on your life remains. When you are ready to let go of the bricks that are weighing you down because of what you have done and turn them over to God, your calling still awaits. God didn’t change just cause you did. God’s call on your life didn’t change.

5. Don’t deny the cross – By not accepting the forgiveness of Christ for what you have done, you deny his sacrifice for you. You were never worthy of that sacrifice to begin with nor will you start now.

Any Christian of course, when times like this confront them, must of course stand back and reevaluate where they are. It may call for a time to step back from ministry and think about what it is you have done, the reasons behind it, and correct it. In the end, when you return to ministry again, your testimony becomes more powerful as God has restored you when it all seemed hopeless.

The truth is, however, I can quote scripture about forgiveness until I am blue in the face, pray with you unceasingly, and you can talk to all the spiritual gurus you know. You can go to church, read the Bible, and pray out of habit but nothing will change until you are ready inside yourself to come to grips with what you have done, ask for forgiveness and move on from it.  This is not something you can intellectually do. It’s something that has to occur within your soul, between you and God. And that is quite appropriate as that is where the beginning of ministry is.

God’s work awaits and you are part of that, and the the local church body you attend miss your contributions – and YOU!. So get right with God, get your heart and mind focused on who you should be focusing on, and get back to work!

Technorati Tags: ,,,,,,,,,,,,,,,


Leave a comment

Print Barcode Labels with

Good afternoon everyone! I had an extremely quiet evening last night and this morning. We are really at crunch time at work right now but I think I am where I need to be with what I need to do.

Anyway, today’s topic is one that can throw a lot of for fits. We need to print barcode labels but some characters don’t translate as you would expect in print. So this class is a little old but it still works. Make it a great day!


Imports System.Drawing.Printing
Imports System.Drawing.Graphics
Public Class Form1
    Inherits System.Windows.Forms.Form
    Private WithEvents BarcodeDoc As barcode.TextPrint ‘BarcodingParts.TextPrint

#Region " Windows Form Designer generated code "

    Public Sub New()

        ‘This call is required by the Windows Form Designer.

        ‘Add any initialization after the InitializeComponent() call

    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
            End If
        End If
    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 PrintDocument1 As System.Drawing.Printing.PrintDocument
    Friend WithEvents Button1 As System.Windows.Forms.Button
    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(Form1))
        Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument
        Me.Button1 = New System.Windows.Forms.Button
        Me.PrintPreviewDialog1 = New System.Windows.Forms.PrintPreviewDialog
        Me.Button1.Location = New System.Drawing.Point(196, 224)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        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(132, 132)
        Me.PrintPreviewDialog1.MinimumSize = New System.Drawing.Size(375, 250)
        Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"
        Me.PrintPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty
        Me.PrintPreviewDialog1.Visible = False
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Name = "Form1"
        Me.Text = "Form1"

    End Sub

#End Region
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        ‘ BarcodeDoc = New BarcodingParts.TextPrint("*00417955*", "Here is Second line from Extended Barcode")
        ‘ BarcodeDoc.Font = New Font("FREE 3 OF 9 Extended", 30) ‘<—- Free Font on the internet or add your own
        ‘ OR USE THIS
        BarcodeDoc = New TextPrint("*00417 955*", "Here is Second line from Regular Barcode")
        BarcodeDoc.Font = New Font("FREE 3 OF 9", 30) ‘<—- Free Font on the internet or add your own
        ‘For Pre-veiw Printing
        PrintPreviewDialog1.Document = BarcodeDoc

        ‘For Direct Printing
        Dim PrintDialog1 As New PrintDialog
        ‘PrintDialog1.Document = BarcodeDoc
    End Sub
    Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        BarcodeDoc.PrinterSettings.PrinterName = InitializeDefaultPrinter() ‘"Zebra"
        BarcodeDoc.DefaultPageSettings.Margins.Left = 10
        BarcodeDoc.DefaultPageSettings.Margins.Right = 10
        BarcodeDoc.DefaultPageSettings.Margins.Top = 40
    End Sub
#Region " Initialize Default Printer "
    Public Function InitializeDefaultPrinter()
        ‘ Set the specified printer to the default printer for this program. Return
        ‘ true if the printer was found.

        Dim objprinter As PageSettings = New PageSettings
        Dim strname = objprinter.PrinterSettings.PrinterName

        InitializeDefaultPrinter = strname
    End Function
#End Region
End Class


Public Class TextPrint
    ‘ Inherits all the functionality of a PrintDocument
    Inherits Printing.PrintDocument
    ‘ Private variables to hold default font and text
    Private fntPrintFont As Font
    Private strText As String
    Private strText2 As String
    Private PrintBarCodeText As String
    Public Sub New(ByVal Text As String, ByVal Text2 As String)
        ‘ Sets the file stream
        strText = Text
        strText2 = Text2
    End Sub
    Public Property Text() As String
            Return strText
        End Get
        Set(ByVal Value As String)
            strText = Value
        End Set
    End Property
    Public Property Text2() As String
            Return Trim(strText2)
        End Get
        Set(ByVal Value As String)
            strText2 = Trim(Value)
        End Set
    End Property
    Public Property CodeText() As String
            PrintBarCodeText = Trim(Replace(strText, "*", " "))
            Return PrintBarCodeText
        End Get
        Set(ByVal Value As String)
            If PrintBarCodeText = "" Then
                PrintBarCodeText = Trim(Replace(Value, "*", " "))
            End If
            PrintBarCodeText = Value
        End Set
    End Property
    Protected Overrides Sub OnBeginPrint(ByVal ev As Printing.PrintEventArgs)
        ‘ Run base code
        ‘ Sets the default font
        If fntPrintFont Is Nothing Then
            fntPrintFont = New Font("Times New Roman", 12)
        End If
    End Sub
    Public Property Font() As Font
        ‘ Allows the user to override the default font
            Return fntPrintFont
        End Get
        Set(ByVal Value As Font)
            fntPrintFont = Value
        End Set
    End Property
    Protected Overrides Sub OnPrintPage(ByVal ev As Printing.PrintPageEventArgs)
        ‘ Provides the print logic for our document

        ‘ Run base code
        ‘ Variables
        Static intCurrentChar As Integer
        Dim intPrintAreaHeight, intPrintAreaWidth, intMarginLeft, intMarginTop As Integer
        ‘ Set printing area boundaries and margin coordinates
        With MyBase.DefaultPageSettings
            intPrintAreaHeight = .PaperSize.Height – .Margins.Top – .Margins.Bottom
            intPrintAreaWidth = .PaperSize.Width – .Margins.Left – .Margins.Right
            intMarginLeft = .Margins.Left ‘X
            intMarginTop = .Margins.Top   ‘Y
        End With
        ‘ If Landscape set, swap printing height/width
        If MyBase.DefaultPageSettings.Landscape Then
            Dim intTemp As Integer
            intTemp = intPrintAreaHeight
            intPrintAreaHeight = intPrintAreaWidth
            intPrintAreaWidth = intTemp
        End If
        ‘ Calculate total number of lines
        Dim intLineCount As Int32 = CInt(intPrintAreaHeight / Font.Height)
        ‘ Initialise rectangle printing area
        Dim rectPrintingArea As New RectangleF(intMarginLeft, intMarginTop, intPrintAreaWidth, intPrintAreaHeight)
        ‘ Initialise StringFormat class, for text layout
        Dim objSF As New StringFormat(StringFormatFlags.LineLimit)
        ‘ Figure out how many lines will fit into rectangle
        Dim intLinesFilled, intCharsFitted As Int32
        Dim stringSize As New SizeF
        stringSize = ev.Graphics.MeasureString(Mid(strText, _
                    UpgradeZeros(intCurrentChar)), Font, New SizeF(intPrintAreaWidth, _
                    intPrintAreaHeight), objSF, intCharsFitted, intLinesFilled)
        ‘ Print the text to the page
        ev.Graphics.DrawString(Mid(strText, _
            UpgradeZeros(intCurrentChar)), Font, Brushes.Black, rectPrintingArea, objSF)

        ‘ Initialise rectangle printing area for the Barcode Text
        Dim stringFont As New Font("Arial", 12, FontStyle.Bold)
        Dim size As SizeF = ev.Graphics.MeasureString(CodeText, stringFont)
        Dim size2 As SizeF = ev.Graphics.MeasureString(strText2, stringFont)
        Dim BCPrintingArea As New RectangleF(stringSize.Width – size.Width / 2, intMarginTop + stringSize.Height, intPrintAreaWidth, intPrintAreaHeight)

        ‘Move Second line to center
        Dim moveStr As Integer
        moveStr = stringSize.Width – size2.Width / 2
        moveStr = intMarginLeft + (moveStr / intMarginLeft)
        Dim BCPrintingArea2 As New RectangleF(moveStr, intMarginTop + stringSize.Height + size2.Height, intPrintAreaWidth, intPrintAreaHeight)

        ‘ADD text Bottom of Barcode
        ev.Graphics.DrawString(CodeText, stringFont, Brushes.Black, BCPrintingArea)
        ev.Graphics.DrawString(strText2, stringFont, Brushes.Black, BCPrintingArea2)

        ‘ Increase current char count
        intCurrentChar += intCharsFitted
        ‘ Check whether we need to print more
        If intCurrentChar < strText.Length Then
            ev.HasMorePages = True
            ev.HasMorePages = False
            intCurrentChar = 0
        End If
    End Sub
    Public Function UpgradeZeros(ByVal Input As Integer) As Integer
        ‘ Upgrades all zeros to ones
        ‘ – used as opposed to defunct IIF or messy If statements
        If Input = 0 Then
            Return 1
            Return Input
        End If
    End Function

End Class

Technorati Tags: ,,,,,,,,,,,,,,,,,

1 Comment

Wait for External Process to Complete with

Good Morning all! Yesterday was an intense day of coding as we are in the middle of rollout of our plans at work. These plans have what are called Elements, and those elements have element details, allocators, allocator details, allocator detail rules, rates, rate tables, rate table details, and rate table detail items.  i got tired of manually creating these when others were so close so I came up with code to duplicate the element and what was below to another plan. So I was happy.

Today’s topic is how to get your application to wait for an external process that you called with System.Diagnostics.Process to finish. Make it a great day!

Sub Main()
        Dim TgtDirectory As String = "MyDir\"
        Dim XYZFilter As String = "*.xyz"
        Dim FileList As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
        Dim Process As New System.Diagnostics.Process
        FileList = My.Computer.FileSystem.GetFiles(TgtDirectory, _
        FileIO.SearchOption.SearchTopLevelOnly, XYZFilter)
         For Each foundfile As String In FileList
            Using P As Process = Process.Start("dlg2dlx.bat", foundfile)
            End Using
    End Sub

Join me on Facebook

Technorati Tags: ,,,,,,,,,,,,

Leave a comment

Place Excel Chart in Microsoft Word Document with

Good Morning! Well my time publish didn’t work like I wanted it to. But that’s okay I am sure I did something wrong.

My night was not great. But lets leave it at that.

Anyway, yesterday’s post we created a chart in Excel and now we want to put that chart into a Microsoft Word Document. Not complicated stuff now but it drove me nuts for a while.

Make it a great day!

Join me on Facebook


‘Dim Word As Word.Application

‘Dim WSheet As New Excel.Worksheet
‘       WSheet = Excel.Workbooks.Add.Worksheets.Add

Label3.Text = "Creating Word Table…."
        Word.Application.ActiveWindow.ActivePane.Document.Tables.Add(Range:=Word.Application.ActiveWindow.ActivePane.Document.Content.Application.Selection.Range, NumRows:=3, NumColumns:= _
                                1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _

Label3.Text = "Adding RX Chart to Word Document……"

        WSheet3.Application.ActiveChart.CopyPicture( _
                                       Appearance:=1, Size:=1, Format:=-4147)
        Word.Application.ActiveWindow.Selection.Tables.Item(1).Cell(1, 1).Range.Select()
        Word.Application.ActiveWindow.Selection.PasteSpecial(Link:=False, DataType:=3, _
                    Placement:=0, DisplayAsIcon:=False)


Technorati Tags: ,,,,,,,,,,,,,,,,

1 Comment

Create Data Bound Excel Chart with

Good Morning! This post is being written early because I knew I would be busy the next couple of days. I am hoping this is published at the time I ask that it be done! If not, I guess you got two posts early!

Today and tomorrow’s topic are interrelated. Basically first we want to create a databound Excel Chart using a specified Excel worksheet as its data source using Tomorrow we will address adding that Excel Chart to a Microsoft Word document with

This assumes you already have a worksheet populated with data. If you are unsure of how to do this with see here.

Make it a great day!

Join me on Facebook


‘ASSUMED Dim WSheet As New Excel.Worksheet
        ‘ASSUMED WSheet = Excel.Workbooks.Add.Worksheets.Add

Label3.Text = "Adding RX Chart….."
        ‘ WSheet.Application.ActiveChart.Name = "TxChart"
        ‘WSheet.Application.ActiveChart.ApplyCustomType(ChartType:=21, TypeName:="Column – Area")
        WSheet.Application.ActiveChart.SetSourceData(Source:=Excel.Application.Sheets(thisname).Range("B1:L14"), PlotBy _

        WSheet.Application.ActiveChart.SeriesCollection(1).XValues = "=" & thisname & "!R2C1:R14C1"
        With WSheet.Application.ActiveChart
            .HasTitle = True
            .ChartTitle.Characters.Text = "Network Use – RX for " & CustomerName & vbCrLf & CombinedDate
            .Axes(1, 1).HasTitle = True
            .Axes(1, 1).AxisTitle.Characters.Text = "Hours"
            .Axes(2, 1).HasTitle = True
            .Axes(2, 1).AxisTitle.Characters.Text = "WAN%"
            .Name = "rxChart"
            .ChartType = 76
            .Legend.Font.Size = 12
        End With
        With WSheet.Application.ActiveChart.PageSetup
            .ChartSize = 2
            .CenterHorizontally = False
            .CenterVertically = False
            .Orientation = 2
            .Draft = False
            .BlackAndWhite = False
            .Zoom = 70
        End With

        WSheet.Application.Selection.Height = 400

        WSheet.Application.ActiveChart.HasDataTable = False
        Label3.Text = "Page Setup For RX Worksheet…."
        With WSheet.PageSetup
            .RightHeader = "Page &P Of &N"

            .RightHeader = "Page &P Of &N"
            .CenterHeader = ""
            ‘.LeftHeader = ‘arrgen.ItemNumberGlobal & " " & ReportType & vbCrLf & ReportComments
            .LeftHeader = CustomerName & " Network Usage (Rx) on " & CombinedDate & " for " & CustomerName ‘arrgen.ItemNumberGlobal & " " & ReportType & vbCrLf & ReportComments
            .LeftFooter = "Property of Kelly Martens"

            .RightFooter = "&D / &T"

            .LeftMargin = WSheet.Application.InchesToPoints(0.54)

            .RightMargin = WSheet.Application.InchesToPoints(0.3)
            .TopMargin = WSheet.Application.InchesToPoints(1.0)

            .BottomMargin = WSheet.Application.InchesToPoints(1.0)
            .PrintHeadings = False
            .PrintGridlines = True
            .PrintComments = -4142 ‘XlPrintLocation.xlPrintNoComments
            .CenterHorizontally = True
            .CenterVertically = False
            .Orientation = 2 ‘XlPageOrientation.xlLandscapeXlPageOrientation.xlLandscape
            .PrintTitleRows = "$1:$1"
            .Draft = False
            .Order = 1 ‘XlOrder.xlDownThenOver
            .BlackAndWhite = False
            .Zoom = False
            .FitToPagesWide = 100
            .FitToPagesTall = 100
            .Zoom = 80
        End With

Join me on Facebook

Technorati Tags: ,,,,,,,,,,,,

Leave a comment

Check if SQL Database Exists on a Server with

Good Morning! Well yesterday I told you I was considering doing a new project. It seems there is someone else who has done something similar and does even more than what I was thinking of doing. I decided that it is ok. Really I am writing it for myself as exercise for my coding skills so I am going to do it anyway. But I probably will get it anyway (am awaiting the download link from a friend) just cause it sounds really cool.

Anyway, today’s topic is to check to see if a SQL database already exists on a server. My thinking is when the user added a database we only want to let them add that database once. So here it is. Make it a great day!

Join me on Facebook

Public Shared Function CheckDatabaseExists(ByVal server As String, ByVal database As String) As Boolean
        Dim connString As String = ("Data Source="  _
                    + (server + ";Initial Catalog=master;Integrated Security=True;"))
        Dim cmdText As String = ("select * from master.dbo.sysdatabases where name=\’"  _
                    + (database + "\’"))
        Dim bRet As Boolean = false
        Using sqlConnection As SqlConnection = New SqlConnection(connString)
        Using sqlCmd As SqlCommand = New SqlCommand(cmdText, sqlConnection)
        Using reader As SqlDataReader = sqlCmd.ExecuteReader
        bRet = reader.HasRows
        End Using
        End Using
        End Using
        Return bRet
    End Function

Technorati Tags: ,,,,,,,,,,,,,


My New Project – Multiple SQL Server and Multiple Database Query Wizard

Good afternoon all. I have decided what my next project will be. It is for fun and like always will have a work application.

It will be written in 1.1 of the Framework. It will automatically create the SQL query statements that will allow joins between multiple servers and databases on each server. It will seek to allow joins between different databases and tables, along with criteria and sorts.

It will have a tab control. On the first tab, we allow them to add the servers. The second tab they add the databases. On the third tab they will add the tables from each database that they can select. On the fourth tab they pick the fields from each table that will be joined. On the fifth tab they enter their criteria for the query. On the sixth tab, they will pick the sort fields. Then finally the opportunity to save their selections to look at later and then to generate the SQL query.

At first, it will only be SELECT statements. Eventually I want to incorporate UPDATE and INSERT statements.

My goal is to make sure both non developer and developers find this tool useful and understandable.

Feel free to leave feedback of what you think of my ideas and make suggestions of what you would like to see in something like this. I am kind of excited and have already gotten started.

Make it a great day!

Technorati Tags: ,,,,,,,,,,,,, statements,,,,,


My buddy at work better share


Display Multiple rdlc files using one Report Viewer Control using

Good Morning! Sorry it has been so long. What have I been up to? Well work is crazy right now. Lots of long weekends, nights and such. I installed Windows 7 after recovering from my  hard drive crash, along with SQL 2008 and am learning my way around that. Positive results so far.

Anyway, I needed to display multiple rdlc files using one report viewer control. No sense in creating 50 of the controls right? So here it is. Make it a great day!

Join me on Facebook

Public Sub PrintOrder(ByVal orderToPrint As Dal.Model.Order)   
            Using rvf As New ReportViewForm()
                With rvf.TheReportViewer
                    rvf.FormCaption = "Order Report Viewer"
                    rvf.ReportDisplayName = String.Format("{0}-Order-{1}", Dal.MiscInterface.GetSalesmanNumber, orderToPrint.ID)
                    .ProcessingMode = ProcessingMode.Local
                    .LocalReport.ReportEmbeddedResource = "OE.OrderReportRegular.rdlc"
                    Dim ol As New List(Of Dal.Model.Order)
                    .LocalReport.DataSources.Add(New ReportDataSource("Dal_Model_Order", ol))
                    .LocalReport.DataSources.Add(New ReportDataSource("Dal_Model_OrderLineItem", orderToPrint.LineItemList))
                    Dim parms() As ReportParameter = New ReportParameter(17) {}
                    parms(0) = New ReportParameter("BTCustomerName", orderToPrint.CustomerName)
                    parms(1) = New ReportParameter("BTCustomerFullAddr", orderToPrint.CustomerFullAddress)
                    parms(2) = New ReportParameter("STCustomerName", orderToPrint.ShipToName)
                    parms(3) = New ReportParameter("STCustomerFullAddr", orderToPrint.FullShipToAddress)
                    parms(4) = New ReportParameter("OrderId", orderToPrint.ID.ToString)
                    parms(5) = New ReportParameter("CombinedId", orderToPrint.CombinedId.ToString)
                    parms(6) = New ReportParameter("EntryDate", orderToPrint.OrderDate.ToShortDateString)
                    parms(7) = New ReportParameter("CustomerId", orderToPrint.CustomerNumber)
                    parms(8) = New ReportParameter("OrderType", orderToPrint.OrderTypeDescription)
                    parms(9) = New ReportParameter("DiscountPercentage", orderToPrint.CustomerDiscountPercentage.ToString)
                    parms(10) = New ReportParameter("SubTotal", orderToPrint.TotalDollars.ToString)
                    parms(11) = New ReportParameter("DiscountAmount", orderToPrint.CustomerDiscountAmount.ToString)
                    parms(12) = New ReportParameter("GrandTotal", orderToPrint.TotalDollarsLessCustDiscount.ToString)
                    parms(13) = New ReportParameter("ShipMethod", orderToPrint.ShipMethod.ToString)
                    parms(14) = New ReportParameter("CreditTerms", orderToPrint.CreditTermsDescription.ToString)
                    parms(15) = New ReportParameter("Status", orderToPrint.OrderStatusDesc.ToString)
                    parms(16) = New ReportParameter("DSCNumber", Dal.MiscInterface.GetSalesmanNumber)
                    parms(17) = New ReportParameter("CustomerNotes", orderToPrint.CustomerNotes(-1))
                End With
                rvf.ToolBar.Items("uxEMail").Visible = True
                rvf.ToolBar.Items("uxExit").Visible = True
            End Using
        Catch ex As Exception
            ErrorHandler.DisplayAndLog(ex, "Problem while printing order.", True)
        End Try
    End Sub

Join me on Facebook

Technorati Tags: ,,,,,,,,,,,,,,




Leave a comment