473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Print Selected Records on canvas

I want to print Selected Records on canvas (For Demand Draft Printing) using silverlight 4 C#.

1: on my mainpage.xmal I taken Data grid with Check box selection and Canvas.

2: I want to print Selected record on Canvas but it is not printing it give a exception error,

i.e Dialogs must be user-initiated.(Security Exception was unhanded by user) following code i do but it not working properly pl help me to do this.

private void btnPrint_Click(object sender, RoutedEventArgs e)
{
int count = 0;
int printCount = 0;
PrintDocument docToPrint = new PrintDocument();

foreach (ServiceReference1.DDDEMO dd in obcDDDemo)
{
textBlock1.Text =dd.Name.ToString(); //Payee name.
textBlock2.Text =dd.Amount.ToString();//Amount

docToPrint.PrintPage += (s, args) =>
{
args.PageVisual = canvas1;
printCount++;

if (printCount < count)
{
args.HasMorePages = true;
}
else
{
args.HasMorePages = false;
}
};
docToPrint.Print("Document");
}
}
Nov 2 '11 #1
0 1456

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: DD | last post by:
I have a mainForm with a subForm On the main form i have a combo with March 04, April 04 etc, you select a date and the subform shows all records for the selected date. I can print a selected...
3
by: DD | last post by:
I have a mainform with a subform. > The main form has a dropdown box "chooseMonth", in the afterupdate event > i requery the subform so all records with the same date are viewed. > Now i only want...
2
by: David | last post by:
Hi, I have an order form which has a field 'ProductID'. This form has a button on each record to open a new form linked by ProductID. This new form is a continuous form and obviously, only...
3
by: orbitus | last post by:
I know that I am overcomplicating this. I have records that need to be printed. Lets say 536 records, some on two or more pages in the report. I want to print 30 records, then 30 more till the...
2
by: indrag91 | last post by:
hai, i am using access database. Iam selecting few records based on a condition. For e:g select * from stud where avg>90 and placing these records in a multiselect list box. for e:g if there 10...
4
by: =?Utf-8?B?bWFyeGk=?= | last post by:
Now I need to lock the selected records for some time and others can not update these records meanwhile. How can I do? any help will be very appreciated!! -- marxi
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
1
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who have said yes to privacy. The user inputs a date...
1
by: krunalkakadia | last post by:
hi all, i have my print linkbutton in gridview column.when i click on it i need to print the selected record. how can i print selected gridview records?is there any code for the same then give...
1
by: eneyardi | last post by:
How to filter selected records in a report? for example: i have a form name ADM List, the default view is split form so that i can view all the records. my report name is ADM Report. in ADM List i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.