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

PrintPreviewControl problem...

137 100+
Hello,
I have a problem with the printpreviewcontrol under windows 7.
It only occures under windows 7 not xp.
I start a new form with the PrintPreviewContol on it and a PrintDocument.
In this case, everything goes perfect.
But when i add the PrintDocument to the PrintPreviewControl it goes wrong (PrintPreviewControl1.Document = PrintDocument1)

Any idea where this comes from?
Thanks!
Paul
Jul 15 '10 #1
3 2079
djpaul
137 100+
Anybody any idea, please?
Jul 27 '10 #2
Joseph Martell
198 Expert 128KB
Any more details on what you mean by "it goes wrong"? Are you getting an exception or unexpected output? Are you developing on an XP machine and deploying to a Windows 7 machine, or can you debug the application on the Windows 7 box?
Jul 27 '10 #3
djpaul
137 100+
Hello,
First i was developing on a xp system and the program executes with an exeption.
So i developed on the windows 7 a new form and going step by step until it goes wrong.
As it finaly goes wrong, he executes with an exeption:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

In the stackTrace:
at System.Drawing.Internal.IntUnsafeNativeMethods.Int DeleteDC(HandleRef hDC)
at System.Drawing.Internal.IntUnsafeNativeMethods.Del eteHDC(HandleRef hDC)
at System.Drawing.Internal.DeviceContext.Dispose(Bool ean disposing)
at System.Drawing.Internal.DeviceContext.Dispose()
at System.Drawing.Printing.PreviewPrintController.OnE ndPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDial og.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(Prin tDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at System.Windows.Forms.PrintPreviewControl.ComputePr eview()
at System.Windows.Forms.PrintPreviewControl.Calculate PageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallba ckDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallba ckHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Objec t userData)
at System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallba ck(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallba cks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.PrintPreviewControl.WndProc(M essage& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
at TestApplication.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Does this help you more?
Regards,
Paul
Jul 27 '10 #4

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

Similar topics

0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
0
by: Chad Chisholm | last post by:
I have the PrintPreviewControl on a form, a custom print options dialog. When the user changes a print option (like gridlines) I set the Document property of the PrintPreviewControl, thereby...
0
by: s-galit | last post by:
hi, i created form1 with a printPreviewControl and from form2 im creating an reference to the form1 , but the printPreviewControl is empty thats the code from form2- Dim printPrevCtrl1 As...
3
by: Ramsey Schaffnit | last post by:
Context: I have to print personal information on a preprinted form I've never seen using a printer I've never seen. I want to use a control to overlay the PrintPreview to indicate where I've...
0
by: Ali Khawaja | last post by:
On initialization of my form, I am setting up PrintPreviewControl like this: > private void InitializePrintPreviewControl() > { > this._ppreview = new ICS.Client.Controls.PrintPreview(); >...
0
by: Yaron | last post by:
Hi, I have a PrintPreviewControl placed inside an inherited control (I am designing a wizard, and each wizard 'panel' is technically a control... The PrintPreviewControl is inside one of these...
0
by: Sachin | last post by:
Hello, I am trying to make a customized PrintPreviewDialog using PrintPreviewControl. Can any one please explain how to change the cursor only on the document that is displayed in the Preview...
0
by: Chad Chisholm | last post by:
I have the PrintPreviewControl on a dialog, and it's a great way to show the user what effect print settings have in somewhat real time. The only problem is when I set...
1
by: Chris Dunaway | last post by:
I am using the PrintPreviewControl on a custom form to display a report. The report is multiple pages. I have a NumericUpDown control on the form to navigate the pages of the report. In the...
3
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
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...

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.