TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
james james
NA
419
30k
Validate Check box before printing
Aug 11 2017 12:16 PM
I have 3 checkboxes that at least one needs to be checked before printing. I have the check boxes linked to the Print button. when i click print a message box states to check one box. when i check the box nothing happens.
<div>private void btnPrint_Click(object sender, EventArgs e)
{
try
{
if (!checkBox1.Checked && !checkBox2.Checked && !checkBox3.Checked)
{
MessageBox.Show("Please select one !");
}
}
catch (Exception ex)
{
printDocument1.PrintPage += printDocument1_PrintPage;
printDocument1.Print();
}
}
private void printDocument1_PrintPage_1(object sender, PrintPageEventArgs e)
{
try
{
e.PageSettings.Landscape = true;
Bitmap bm = new Bitmap(this.panel.Width, this.panel.Height);
panel.DrawToBitmap(bm, new Rectangle(0, 0, this.panel.Width, this.panel.Height));
e.Graphics.DrawImage(bm, 0, 0, bm.Width, bm.Height);
}
catch (Exception ex)
{
string s1 = ex.Message;
}
}
}
}<div>
Attachment:
private_void_btnPrint.zip
Reply
Answers (
8
)
SutonnyMJ font use in iTextSharp for pdf
Name is ahowing blank in vs 2017