Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamically creating objects using reflection Pin
Phillip M. Hoff17-Jan-07 17:37
Phillip M. Hoff17-Jan-07 17:37 
GeneralRe: Dynamically creating objects using reflection Pin
mcd242417-Jan-07 18:07
mcd242417-Jan-07 18:07 
GeneralRe: Dynamically creating objects using reflection Pin
Phillip M. Hoff17-Jan-07 19:17
Phillip M. Hoff17-Jan-07 19:17 
GeneralRe: Dynamically creating objects using reflection Pin
Russell Jones17-Jan-07 23:00
Russell Jones17-Jan-07 23:00 
QuestionC# Dial-up manager Pin
oren201017-Jan-07 15:49
oren201017-Jan-07 15:49 
Questionget folder content form a webservice Pin
gcorgnet17-Jan-07 15:40
gcorgnet17-Jan-07 15:40 
AnswerRe: get folder content form a webservice Pin
mcd242417-Jan-07 17:10
mcd242417-Jan-07 17:10 
QuestionInconsistent Exceptions While Printing Pin
mfgalizia17-Jan-07 14:29
mfgalizia17-Jan-07 14:29 
Hello all,

Hopefully someone can help me solve this problem. I'm trying to print a PrintDocument, but I get inconsistent results. Sometimes it works, and sometimes I get "The handle is invalid" or "Incorrect parameter" exceptions. I stripped it down to the following code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Printing;

namespace PrintTest
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            PrintDocument pd = new PrintDocument();

            PageSetupDialog psd = new PageSetupDialog();
            psd.Document = pd;

            if (psd.ShowDialog() == DialogResult.OK)
            {
                PrintPreviewDialog ppd = new PrintPreviewDialog();
                ppd.Document = pd;
                try
                {
                    ppd.ShowDialog();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Exception");
                    ppd.Close();
                }
            }
        }
    }
}

Thanks in advance!
AnswerRe: Inconsistent Exceptions While Printing Pin
Luc Pattyn17-Jan-07 16:24
sitebuilderLuc Pattyn17-Jan-07 16:24 
GeneralRe: Inconsistent Exceptions While Printing Pin
netJP12L18-Jan-07 4:53
netJP12L18-Jan-07 4:53 
GeneralRe: Inconsistent Exceptions While Printing Pin
mfgalizia18-Jan-07 11:28
mfgalizia18-Jan-07 11:28 
GeneralRe: Inconsistent Exceptions While Printing Pin
mfgalizia21-Jan-07 12:45
mfgalizia21-Jan-07 12:45 
GeneralRe: Inconsistent Exceptions While Printing Pin
mfgalizia21-Jan-07 13:23
mfgalizia21-Jan-07 13:23 
GeneralRe: Inconsistent Exceptions While Printing Pin
Luc Pattyn21-Jan-07 13:52
sitebuilderLuc Pattyn21-Jan-07 13:52 
GeneralRe: Inconsistent Exceptions While Printing Pin
mfgalizia21-Jan-07 14:11
mfgalizia21-Jan-07 14:11 
GeneralRe: Inconsistent Exceptions While Printing Pin
Luc Pattyn21-Jan-07 15:00
sitebuilderLuc Pattyn21-Jan-07 15:00 
QuestionAdobe Reader licensing question Pin
standgale17-Jan-07 11:49
standgale17-Jan-07 11:49 
AnswerRe: Adobe Reader licensing question Pin
Luc Pattyn17-Jan-07 16:30
sitebuilderLuc Pattyn17-Jan-07 16:30 
QuestionRun Commands On Other Computers Pin
MartyExodus17-Jan-07 11:26
MartyExodus17-Jan-07 11:26 
AnswerRe: Run Commands On Other Computers Pin
Christian Graus17-Jan-07 11:52
protectorChristian Graus17-Jan-07 11:52 
AnswerRe: Run Commands On Other Computers [modified] Pin
MartyExodus17-Jan-07 12:16
MartyExodus17-Jan-07 12:16 
QuestionGetting Row Index for Current Row on DataGridView Pin
Jawa200617-Jan-07 11:18
Jawa200617-Jan-07 11:18 
QuestionHow to control tooltip display time on DataGridView Pin
smcneese17-Jan-07 10:09
smcneese17-Jan-07 10:09 
QuestionHow to show a child relation column into parent DatagridView ? Pin
Marcos Hernandez17-Jan-07 10:05
Marcos Hernandez17-Jan-07 10:05 
QuestionLabel Control Size Problem ..? Pin
Software_Specialist17-Jan-07 10:04
Software_Specialist17-Jan-07 10:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.