I am trying to write a program to display system information. I have that part down. I am using a listbox, so that I can have different lines, for example:
ListBox1.Items.Add("Computer Name: " & My.User.Name) ListBox1.Items.Add("OS Version:" & My.Computer.Info.OSVersion)
I am running into problems when I try to print. I have added the following code, per an instruction manual:
Private printpagesettings As New PageSettings Private stringtoprint As String Private printfont As New Font("Arial", 10)
Private Sub PrintInformationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintInformationToolStripMenuItem.Click Try ListBox1.SelectedItems.ToString() PrintDocument1.DefaultPageSettings = printpagesettings stringtoprint = ListBox1.SelectedItems.ToString PrintDialog1.Document = PrintDocument1 Dim result As DialogResult = PrintDialog1.ShowDialog If result = DialogResult.OK Then PrintDocument1.Print() End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
However, when I go to print, and select both values from my list box, it will only print one line, not both. Any thoughts would be greatly appriciated. Thanks!