Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I only want to print some of the textBoxes and comboBoxes not all of them so I can't use the print as an image.

How can I change this so that if it isn't 0 it will show it.


C#
private void button2_Click(object sender, EventArgs e)
        {
            printPreviewDialog1.Document = printDocument1;

            printPreviewDialog1.ShowDialog();
        }

private void printDocument1_PrintPage_1(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
  if (textBox1.Text = 0)
   e.Graphics.DrawString(textBox1.Text, textBox1.Font, Brushes.Black, 100, 120);
   e.Graphics.DrawString(comboBox1.Text, comboBox1.Font, Brushes.Black, 100, 100);

         }
Posted

1 solution

Change that if statement to this:
C#
if (textBox1.Text.Length != 0)
etc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900