Results 1 to 4 of 4
  1. #1
    Jàzzà_'s Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    185
    Reputation
    11
    Thanks
    97
    My Mood
    Cool

    [HELP] Print Function & Print Preview[Solved]

    Hey guys this is really quick and simple and want no spamming on the thread
    How would i be able to do the Print Function so I can print the text inside my "ListBox" to a printer.
    The same go with Print Preview please.
    I remember the code was really easy but I haven't made something in VB for quiet a while now so I have forgoten ):

    Cheers Jàzzà™ (:
    Last edited by Jàzzà_; 02-07-2011 at 02:41 PM.


    Applications:
    Jàzzà InjectXD | Radio♫ v1.1 | File Name Sorter
    Better than Bombsaway707 Radio (:

  2. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Should Work.

    Wrote it up in a new message from outlook, I was writing a email @ the same time.


    Add a PrintDialog, and a PrintDocument from your toolbox.

    click on the document setting for the PrintDocument and choose printdialog

    (Double)Click PrintDocument inside the generated code add

    [highlight=vbnet]
    Dim x As Integer = e.MarginBounds.Left
    Dim y As Single = e.MarginBounds.Top
    Dim heightofline As Single = Me.ListBox1.Font.GetHeight(e.Graphics)
    For Each item As String In Me.ListBox1.Items
    e.Graphics.DrawString(item, Me.ListBox1.Font, Brushes.Black, x, y)
    y += heightofline
    Next
    [/highlight]

    In your button, or menu or whatever you are using add

    [highlight=vbnet]
    If Me.PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
    Me.PrintDocument1.Print()
    End If
    [/highlight]

    Let us know.
    Last edited by NextGen1; 02-07-2011 at 04:05 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  3. #3
    Jàzzà_'s Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    185
    Reputation
    11
    Thanks
    97
    My Mood
    Cool
    Thank you help was much appreciated,
    I should be releasing it quiet soon.
    It worked!
    Last edited by Jàzzà_; 02-07-2011 at 04:16 PM. Reason: It worked!


    Applications:
    Jàzzà InjectXD | Radio♫ v1.1 | File Name Sorter
    Better than Bombsaway707 Radio (:

  4. #4
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Ok, Great. Marked Solved.


     


     


     



    The Most complete application MPGH will ever offer - 68%