ptintout the windowsform

Mar 31 2011 2:21 AM


hai,

i use this code for printing the page with several labels and textboxes but the error will displayed like "The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)     "                            

  plz help.

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace PrintMultipleTextboxes

{

    public partial class Form1 : Form

    {

        Font myfont;

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

           myfont = new Font("Arial", 12);

 

        }

    

 

        private void bttnExit_Click(object sender, EventArgs e)

        {

            this.Close();

        }

        private void bttnPreview_Click(object sender, EventArgs e)

        {

            printPreviewDialog1.Document = printDocument1;

            printPreviewDialog1.ShowDialog();

        }

 

 

 

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)

        {

 

            foreach (Control t in this.Controls)

            {

                if (t is TextBox)

                {

                    e.Graphics.DrawString(t.Text, myfont, Brushes.Black, t.Left + 10, t.Top + 10);

                }

 

            }

       

        }

 

 

      

 

    }

}

 


Answers (2)