473,804 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 btnPageSetupDia log opens the
PageSetupDialog . Same with the PrintDialog (see one example
below:btnPrinte rSetup.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.EventArg s) _
Handles btnPrinterSetup .Click

PrintDialog.Pri nterSettings = PrintDocument.P rinterSettings
Try
If PrintDialog.Sho wDialog(Me) = DialogResult.OK Then
PrintDocument.P rinterSettings = PrintDialog.Pri nterSettings
'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 2619
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
3208
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
5390
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, the value of the "DefaultPageSettings.Landscape" is still false !!?? Code Exemple : PrintDialog PDialog = new PrintDialog(); PDialog.PrinterSettings = new System.Drawing.Printing.PrinterSettings();...
6
3276
by: Just Me | last post by:
Dim PageSetupDialog As New PageSetupDialog With PageSetupDialog ..Document = mPD ....snip
0
1051
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 not always get the correct results. Expertimenting isn't getting me anywhere I need someone who understands the mPD options! I know I can also get page size by zz = mpD.PrinterSettings.DefaultPageSettings.PaperSize.Height
2
4900
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 group border title), click on the OK button, and then open the dialog box again, I find that all the margin values were divided by 2.54. Basically, every time I open that Dialog box and click on OK, all the margin values get divided by 2.54. I...
2
1569
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 dailog box(normal windows file dailog box) on the client side should open in a specific directory only and should filter out files with a specific extension.Moreover the relative path of the selected file should be converted into UNC path and...
1
4834
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 apparently not-initialized properly. It appears to be printing to a very small page size and only prints a small piece of each page. Alternatively, if if a user selects the new printer, then user selects the paper size from the printer properties,...
0
1895
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 I close and reload it. How do I enable these changes to immediately show up in the print preview. See Code Below. Paul Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object,
3
3057
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." "Printing document". When the Message Form is done, it sets the focus back to the Main Form. The document it prints is a Word 2003 document. A dialog box that appears when the document is printing and it takes the focus away from the main document. I am...
0
1136
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 PaperSize in PageSetupDialog And result OK; source code: private void button2_Click(object sender, EventArgs e) { pd = new PrintDocument(); PageSetupDialog mPS = new PageSetupDialog(); foreach...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.