Welcome to InsuranceForums.info!   

Advertisments:


Sponsor Links

Affordable Pet Insurance
Travel Insurance Comparison


How Do You Print Listbox In Visual Basic 2005?

Discussion forum for Insurance Agents

How Do You Print Listbox In Visual Basic 2005?

Postby Connor » Tue Oct 10, 2017 8:08 am

I wish i could upload the file....i need to print out a listbox to a printer (if you can get it to a string then i can print it) called listbox1...here is the code:

Imports System.Drawing.Printing

Public Class frmLumber

Dim y As Integer

Dim x As Integer

Dim z As Integer

Dim t As Integer

Dim str As String

Private Sub cmdDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDisplay.Click

PictureBox1.Visible = False

PictureBox2.Visible = False

PictureBox3.Visible = False

If lblMahogany.Checked = True Then

PictureBox1.Visible = True And PictureBox2.Visible = False And PictureBox3.Visible = False

End If

If lblOak.Checked = True Then

PictureBox2.Visible = True And PictureBox1.Visible = False And PictureBox3.Visible = False

End If

If lblPine.Checked = True Then

PictureBox3.Visible = True And PictureBox1.Visible = False And PictureBox2.Visible = False

End If

End Sub

Private Sub cmdLength_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLength.Click

y = InputBox("Length in Feet")

End Sub

Private Sub cmdQuantity_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdQuantity.Click

z = InputBox("Number of Pieces")

End Sub

Private Sub cmdCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCalculate.Click

If lblMahogany.Checked = True Then

If lbl2x4.Checked = True Then

x = 14

str = "2x4"

End If

If lbl2x6.Checked = True Then

x = 20

str = "2x6"

End If

If lbl4x4.Checked = True Then

x = 16

str = "4x4"

End If

If lblCustom.Checked = True Then MsgBox("See Sales Representitive")

t = x * y * z

If y = 0 Or z = 0 Then

MsgBox("Input desired Lengh and Quantity")

GoTo l

End If

ListBox1.Items.Add("Mahogany X" & z)

ListBox1.Items.Add("Size: " & str)

ListBox1.Items.Add("Total Cost:" & t)

x = 0

y = 0

t = 0

End If

If lblOak.Checked = True Then

If lbl2x4.Checked = True Then

x = 8

str = "2x4"

End If

If lbl2x6.Checked = True Then

x = 10

str = "2x6"

End If

If lbl4x4.Checked = True Then

x = 10

str = "4x4"

End If

If lblCustom.Checked = True Then MsgBox("See Sales Representitive")

t = x * y * z

If y = 0 Or z = 0 Then

MsgBox("Input desired Lengh and Quantity")

GoTo l

End If

ListBox1.Items.Add("Oak X" & z)

ListBox1.Items.Add("Size: " & str)

ListBox1.Items.Add("Total Cost:" & t)

x = 0

y = 0

t = 0

End If

If lblPine.Checked = True Then

If lbl2x4.Checked = True Then

x = 6

str = "2x4"

End If

If lbl2x6.Checked = True Then

x = 8

str = "2x6"

End If

If lbl4x4.Checked = True Then

x = 10

str = "4x4"

End If

If lblCustom.Checked = True Then MsgBox("See Sales Representitive")

t = x * y * z

If y = 0 Or z = 0 Then

MsgBox("Input desired Lengh and Quantity")

GoTo l

End If

ListBox1.Items.Add("Pine X" & z)

ListBox1.Items.Add("Size: " & str)

ListBox1.Items.Add("Total Cost:" & t)

x = 0

y = 0

t = 0

End If

l:

End Sub

Private Sub cmdNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNew.Click

ListBox1.Items.Clear()

End Sub

Private Sub cmdFinalize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFinalize.Click

End Sub

End Class

if yu have a answer i would appreciate it...thx.
Connor
 
Posts: 33
Joined: Wed Mar 26, 2014 2:18 pm

Return to Insurance Agents

 


  • Related topics
    Replies
    Views
    Last post
cron