473,378 Members | 1,138 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,378 software developers and data experts.

PageSetupDialog/PrintDialog close my Dailog box! - Help

When I show my Windows Form as a dialog box (ShowDialog(Me)) and click on a
button that calls the ShowDialog of either the PageSetupDialog or PrintDialog
conrtol, my Windows Form closes After I close the PageSetupDialog or
PrintDialog. This doesn't happen if the Windows Form is displayed using the
Show method.

Does anyone have a solution?

I've made my own Print Setup Dialog Box (frmPrint). I've added the
PrintDocument, PageSetupDialog and PrintDialog controls to the form. I've
added 4 buttons: Page Setup, Print Setup, Print, Close (and a bunch of other
Printer Options stuff not important here). The btnPageSetupDialog opens the
PageSetupDialog. Same with the PrintDialog (see one example
below:btnPrinterSetup.Click).

My custom Printer Form (frmPrinter) stays open in Listing B, but not in
Listing A.
Any solutions?

Private Sub btnPrinterSetup_Click(ByVal sender As System.Object, _
ByVal e As
System.EventArgs) _
Handles btnPrinterSetup.Click

PrintDialog.PrinterSettings = PrintDocument.PrinterSettings
Try
If PrintDialog.ShowDialog(Me) = DialogResult.OK Then
PrintDocument.PrinterSettings = PrintDialog.PrinterSettings
'Custom Stuff
End If
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End Sub

LISTING A
Dim f As New frmPrint()
f.ShowDialog(Me) 'Same problem if I use f.ShowDialog()
f.Dispose()

LISTING A (Modified)
Dim f As New frmPrint()
f.ShowDialog()
'Removed the dispose method (in desperation)

LISTING B
Dim f As New frmPrint()
f.Show()

Nov 21 '05 #1
1 2599
Hi Blaine...

I've put together a VERY simple project sample for you that, I believe,
addresses your issue.

You can download if here http://www.geocities.com/mstrcontrol/Test.zip

Regards,

Paulo

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David | last post by:
Does anybody know how to check the AllowSelection radio button in the PrintDialog Dialog? I want to set this to checked if the user has selected a subset of text.
4
by: Steph. | last post by:
Hi, Is there a BUG in the printdialog ? When I create a PrintDialog ans set the "DefaultPageSettings.Landscape" property to "false" and then display the dialog, select "Landscape" and click OK,...
6
by: Just Me | last post by:
Dim PageSetupDialog As New PageSetupDialog With PageSetupDialog ..Document = mPD ....snip
0
by: Just Me | last post by:
I do the code at the bottom of this, and later use: zz = mPD.DefaultPageSettings.PaperSize.Height and it works most of the time. It's a long story but if I use the printer's "Custom" size I do...
2
by: Amjad | last post by:
I use the PageSetupDialog box to allow the user to change the page margins before printing. The problem is when I open the dialog box and type in margin values in millimeters (as it says in the...
2
by: Viks | last post by:
Hi everyone, I am beginner at javascript.One of the web applications that i am currently developing,requires to upload file from the client side to the server.The condition being that the file...
1
by: Ed Sutton | last post by:
My C# app. apparently has problems with PageSettings not being initialized properly after calling PageSetupDialog. If a user selects a non-default printer from PageSetupDialog, the PageSize is...
0
by: ppeterkin | last post by:
I customized a PrintPreviewDialog by adding a button to it's toolstrip that opens up a PageSetupDialog. The problem is changes made to the page setup are not passed to the PrintPreviewDialog until...
3
Wing
by: Wing | last post by:
I currently have an application that uses full screen. The application is designed to accept the swipe of a card. Another form displays messages for the swiper, ie.. "Searching for your account."...
0
by: ywscr | last post by:
Hello, I am using PageSetupDialog in my application to change the pagesettings of the document,I changed PaperSize To "A4" in PageSetupDialog ,But it's result PaperSize no change ??I want Set...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.