Results 1 to 4 of 4

Thread: [RESOLVED] Textbox highlighted when printing

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    36

    Resolved [RESOLVED] Textbox highlighted when printing

    I am using VB2010, and using the Printform to printing
    However the result is one of the TextBox will highlighted when do printing, see below pic.



    I have no idea what causes it. Any expert can help? Thanks a lot.
    Last edited by Studioalley; Aug 16th, 2011 at 02:36 AM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Textbox highlighted when printing

    try this:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    4.         Array.ForEach(Me.Controls.OfType(Of TextBox).ToArray, Sub(tb As TextBox) tb.DeselectAll())
    5.         'now print
    6.     End Sub
    7.  
    8. End Class

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    36

    Re: Textbox highlighted when printing

    Thanks Paul, it works..........
    Thanks a lot.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [RESOLVED] Textbox highlighted when printing

    A TextBox only shows its selection when it has focus, so all you need do is ensure that no TextBox has focus:
    vb.net Code:
    1. Me.ActiveControl = Nothing

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width