Solved

How do I have the text boxes not print.

Posted on 1998-08-04
3
150 Views
Last Modified: 2010-05-03
Hi, I am just learning Visual Basic and working on my first program. I have a form whith text boxes on it. When I print, it prints the boxes as well. Is there a way to have them show yet not print? I want them on th eform so the user knows to input their data but I don't want them to print, only want the info contained in the box to print. I tried setting Visibility to False but then they don't show up on the form at all. Please help me out if you can, email me at developer@xtremeonline.com if possible. Thank you.
0
Comment
Question by:ShawnX
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
jsuper earned 100 total points
ID: 1467809
Just before the code you are using to print the form, change the visibility of the text boxes to false.  Alfter the code that prints has completed, change the visibilty back to a yes.  For example...

Private Sub cmdPrint_Click()
      txtbox1.visible = false
      txtbox2.visible = false
      form.printform
      txtbox1.visible = true
      txtbox2.visible = true
end sub


0
 
LVL 1

Expert Comment

by:jsuper
ID: 1467810
Actually, now I see what you are saying...   here is what you need to do.   For each textbox, create a label as well. Set  each label.visible to false.  When the user says to print, perform the following code.

Private Sub Print_Click()
    label1.caption = text1.text
    label2.caption = text2.text
    label1.top = text1.top
    label2.top = text2.top
       ' do the same for width, height and left...
   label1.visible = true
  label2.visible = true
  text1.visible = false
  text2.visible = false
form1.printform
   ' Now change the visible settings back to the original values...  
   '  i.e.  textboxes as visible and labels as invisible.

That should do what you want...
0
 

Author Comment

by:ShawnX
ID: 1467811
I don't understand. I made them false, then they don't show up at all. Thanks for a fast reply to my question.

I'll just keep trying, till something works.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now