aunque trato de darle varios formatos un Setup, Preview y un Print de Impresión.
tengo el siguiente código en una dll creada en visual basic 2010(framework 2)
Realizo esta consulta y me arroja en tiempo de ejecucion la referencia a objeto no establecida. siendo que esta esta siendo utilizada.
Código:
Imports PrintableListView Imports System Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Windows.Forms Public Class MainForm Inherits Form Dim vform2 As PrintableListView.PrintableListView Private Sub m_btnPageSetup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m_btnPageSetup.Click vform2.PageSetup() 'Me.m_list.PageSetup() End Sub End Class End Namespace
Código:
Imports System Imports System.ComponentModel Imports System.Drawing Imports System.Drawing.Printing Imports System.Windows.Forms Namespace PrintableListView Public Class PrintableListView Inherits ListView Public Sub PageSetup() Me.m_setupDlg.ShowDialog End Sub Private Sub PreparePrint() Me.m_fListWidth = 0! Me.m_arColsWidth = New Single(MyBase.Columns.Count - 1) {} Dim g As Graphics = MyBase.CreateGraphics Me.m_fDpi = g.DpiX g.Dispose Dim i As Integer For i = 0 To MyBase.Columns.Count - 1 Dim ch As ColumnHeader = MyBase.Columns.Item(i) Dim fWidth As Single = (((CSng(ch.Width) / Me.m_fDpi) * 100!) + 1!) Me.m_fListWidth = (Me.m_fListWidth + fWidth) Me.m_arColsWidth(i) = fWidth Next i Me.m_fListWidth += 1 End Sub Public Sub Print() Me.m_printDlg.AllowSelection = (MyBase.SelectedItems.Count > 0) If (Me.m_printDlg.ShowDialog(Me) = DialogResult.OK) Then Me.m_printDoc.DocumentName = Me.m_strTitle Me.m_bPrintSel = (Me.m_printDlg.PrinterSettings.PrintRange = PrintRange.Selection) Me.m_nPageNumber = 1 Me.m_printDoc.Print End If End Sub Public m_previewDlg As PrintPreviewDialog = New PrintPreviewDialog Public m_printDlg As PrintDialog = New PrintDialog Public m_printDoc As PrintDocument = New PrintDocument Public m_setupDlg As PageSetupDialog = New PageSetupDialog Public m_strTitle As String = "" End Class End Namespace
Llevo como 3 días y no cacho mucho . lo que trate de hacer fue llevar un código en C# que encontré y funciona pero no me resulto al llevarlo a visual basic.
[URL="http://www.codeproject.com/KB/list/PrintableListView/PrintableListView_src.zip"]aquí les dejo el enlace[/URL]