1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

visual basic 2010 priniting

Discussion in 'Business Applications' started by JTHEWOLF, Jan 13, 2011.

Thread Status:
Not open for further replies.
  1. JTHEWOLF

    JTHEWOLF Thread Starter

    Joined:
    Dec 26, 2009
    Messages:
    66
    hi guys i have a basic word processor. i got all the usual comands e.g.bold,italics,justification etc working. but after i put the print dialogs on and code them to what would make sense i get nothing but blanks pages.

    heres my code can someone please help me get this bugger printing :p



    Public Class Form1
    Dim MyPrintObject As New TextPrint(RichTextBox1.Text)

    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
    OpenFileDialog1.Filter = "Rich Text files (*.rtf)|*.rtf"
    OpenFileDialog1.ShowDialog()
    RichTextBox1.LoadFile(OpenFileDialog1.FileName)

    End Sub

    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
    SaveFileDialog1.Filter = "Rich Text files (*.rtf)|*.rtf"
    SaveFileDialog1.ShowDialog()
    RichTextBox1.SaveFile(SaveFileDialog1.FileName)

    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
    Close()
    End Sub

    Private Sub LeftToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LeftToolStripMenuItem.Click
    RichTextBox1.SelectionAlignment = HorizontalAlignment.Left
    End Sub

    Private Sub CentreToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CentreToolStripMenuItem.Click
    RichTextBox1.SelectionAlignment = HorizontalAlignment.Center
    End Sub

    Private Sub RightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RightToolStripMenuItem.Click
    RichTextBox1.SelectionAlignment = HorizontalAlignment.Right
    End Sub

    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
    AboutBox1.Show()
    End Sub

    Private Sub UnderlineToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnderlineToolStripMenuItem.Click
    Dim currentFont As System.Drawing.Font = RichTextBox1.SelectionFont
    If RichTextBox1.SelectionFont.Underline = True Then
    RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Regular)
    Else
    RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Underline)
    End If

    End Sub

    Private Sub BoldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BoldToolStripMenuItem.Click
    Dim currentFont As System.Drawing.Font = RichTextBox1.SelectionFont
    If RichTextBox1.SelectionFont.Bold = True Then
    RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Regular)
    Else
    RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Bold)
    End If

    End Sub

    Private Sub ItalicToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItalicToolStripMenuItem.Click
    Dim currentFont As System.Drawing.Font = RichTextBox1.SelectionFont
    If RichTextBox1.SelectionFont.Italic = True Then
    RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Regular)
    Else
    RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Italic)
    End If

    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
    RichTextBox1.Cut()
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
    RichTextBox1.Copy()
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
    RichTextBox1.Paste()
    End Sub

    Private Sub FontToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem1.Click
    FontDialog1.ShowDialog()
    RichTextBox1.SelectionFont = FontDialog1.Font
    End Sub

    Private Sub ColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColourToolStripMenuItem.Click
    ColorDialog1.ShowDialog()
    RichTextBox1.SelectionColor = ColorDialog1.Color
    End Sub

    Private Sub PrintToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem1.Click

    PrintDialog1.ShowDialog()


    End Sub

    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
    RichTextBox1.Clear()

    End Sub

    Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
    RichTextBox1.Redo()
    End Sub

    Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click
    RichTextBox1.Undo()
    End Sub

    Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
    RichTextBox1.SelectAll()
    End Sub

    Private Sub PrintPreviewDialog1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewDialog1.Load

    End Sub

    Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click
    PrintPreviewDialog1.Document = PrintDocument1

    PrintPreviewDialog1.ShowDialog()
    End Sub

    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

    PrintDocument1.Print()

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    End Class
     
  2. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    77,258
    i won't be able to assist that much, but one thing I can do is move it to business apps; you'll get a few more hits there.

    thanks,

    v
     
  3. JTHEWOLF

    JTHEWOLF Thread Starter

    Joined:
    Dec 26, 2009
    Messages:
    66
    im in the wrong thred??? :s DARN
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - visual basic 2010
  1. Deanhenley1973
    Replies:
    1
    Views:
    167
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/974489

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice