Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Print Preview of LISTVIEW Does NOT match printed Doc

$
0
0
I have a document I am trying to print and in Print Preview and in tghe Printed Doc the 1st colum gets cut off some how.
I have included screen shots.

Print PreviewAttachment 95391


I have set the columns in Listview to Autosize to the cell content but still it cuts off. not sure where to go. Here is my autosize code.
Code:

Private Sub btnSortLists_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSortLists.Click


        'PriceMatchStore.Shopping_List.View = View.Details
        'PriceMatchStore.Shopping_List.Columns.AddRange(New ColumnHeader() _
        '                          {New ColumnHeader With {.Name = "Item", .Text = "Item"}, _
          '                          New ColumnHeader With {.Name = "Brand", .Text = "Brand"}, _
          '                        New ColumnHeader With {.Name = "Size", .Text = "Size"}, _
            '                        New ColumnHeader With {.Name = "Coupon", .Text = "Coupon"}, _
            '                      New ColumnHeader With {.Name = "PriceMatch", .Text = "PriceMatch"}})


        PriceMatchStore.StoreList.View = View.Details
        PriceMatchStore.StoreList.Columns.AddRange(New ColumnHeader() _
                                  {New ColumnHeader With {.Name = "Item", .Text = "Item"}, _
                                    New ColumnHeader With {.Name = "Brand", .Text = "Brand"}, _
                                    New ColumnHeader With {.Name = "Size", .Text = "Size"}, _
                                    New ColumnHeader With {.Name = "Price", .Text = "Price"}, _
                                    New ColumnHeader With {.Name = "Coupon", .Text = "Coupon"}})

        For Each m_row As System.Windows.Forms.DataGridViewRow In Me.ShoppingListView.Rows
            If m_row.Cells("clmcmbStore").Value IsNot Nothing Then
                Dim store As String = m_row.Cells("clmcmbStore").Value.ToString
                Dim group As New ListViewGroup(store, store)
                If Not PriceMatchStore.StoreList.Groups.Cast(Of ListViewGroup).Any(Function(lvg) lvg.Name = store) Then
                    PriceMatchStore.StoreList.Groups.Add(group)
                End If

                Dim item As String = m_row.Cells("clmItem").Value.ToString
                Dim brand As String = m_row.Cells("clmBrand").Value.ToString
                Dim size As String = m_row.Cells("clmQTY").Value.ToString
                Dim price As String = m_row.Cells("clmPrice").Value.ToString
                Dim coupon As String = m_row.Cells("clmCoupon").Value.ToString

                Dim lvItem As New ListViewItem(New String() {item, brand, size, price, coupon})
                PriceMatchStore.StoreList.Items.Add(lvItem)
                PriceMatchStore.StoreList.Groups.Cast(Of ListViewGroup).First(Function(lvg) lvg.Name = store).Items.Add(lvItem)
                PriceMatchStore.StoreList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)
                PriceMatchStore.StoreList.AutoResizeColumn(4, ColumnHeaderAutoResizeStyle.HeaderSize)

            End If

            'If m_row.Cells("clmItem").Value IsNot Nothing Then

                'Dim item As String = m_row.Cells("clmItem").Value.ToString
                'Dim brand As String = m_row.Cells("clmBrand").Value.ToString
                'Dim size As String = m_row.Cells("clmQTY").Value.ToString
                'Dim coupon As String = m_row.Cells("clmCoupon").Value.ToString
                'Dim pricematch As String = m_row.Cells("clmPriceMatch").Value.ToString

                'Dim lvItem As New ListViewItem(New String() {item, brand, size, coupon, pricematch})
                'PriceMatchStore.Shopping_List.Items.Add(lvItem)
              ' PriceMatchStore.Shopping_List.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)
                'PriceMatchStore.Shopping_List.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.HeaderSize)
              ' PriceMatchStore.Shopping_List.AutoResizeColumn(4, ColumnHeaderAutoResizeStyle.HeaderSize)

            'End If

        Next
        PriceMatchStore.ShowDialog()


    End Sub

I am only trying to print the storelist at this point
Attached Images
   

Viewing all articles
Browse latest Browse all 27554

Trending Articles