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 KatarePosted Mar 31, 2011, 2:30 AM
Solution Explorer and select System.Xml.Linq from .Net tab.
FroglegPosted Mar 31, 2011, 2:31 AM
At the top of the code window comment out
//using System.Linq;
See if that works