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?) "
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);
}
}
}
}
}

Raju KatareRank #1,971 · 742 reputationPosted Mar 30, 2011, 10:30 PM EDT
Solution Explorer and select System.Xml.Linq from .Net tab.
FroglegRank #1,020 · 1.9K reputationPosted Mar 30, 2011, 10:31 PM EDT
At the top of the code window comment out
//using System.Linq;
See if that works