From: kimiraikkonen on
On Mar 26, 9:21 am, "JR" <xx....(a)xx.xx> wrote:
> Dim PrintDialog As New PrintDialog
> Dim result As DialogResult = PrintDialog.ShowDialog()
> If result = Windows.Forms.DialogResult.OK Then
> 'I get always cancel(2) as an result and nothing happens
> end if
>
> Why do I aways have cancel as an result. It shout popup but it doens on
> vista 64
>
> Thanxs

JR,
Try This:

If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
' Code
End If

And make sure, you've one printer installed at least.
From: JR on

"kimiraikkonen" <kimiraikkonen85(a)gmail.com> schreef in bericht
news:2e6d0dc1-56da-4875-bf15-1062407a4d48(a)p73g2000hsd.googlegroups.com...
> On Mar 26, 9:21 am, "JR" <xx....(a)xx.xx> wrote:
>> Dim PrintDialog As New PrintDialog
>> Dim result As DialogResult = PrintDialog.ShowDialog()
>> If result = Windows.Forms.DialogResult.OK Then
>> 'I get always cancel(2) as an result and nothing happens
>> end if
>>
>> Why do I aways have cancel as an result. It shout popup but it doens on
>> vista 64
>>
>> Thanxs
>
> JR,
> Try This:
>
> If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
> ' Code
> End If
>
> And make sure, you've one printer installed at least.
sorry,
won't work
still returns cancel
I also added like you suggested a control of the printers. that returns
(like it shout) 3
this is the complete routine
'---------start code-----------
Public Sub sSetPrintVB(ByVal prn As Object)
Dim dlgPrintDialog As New PrintDialog
Try
Dim nPrinterCount As Integer =
System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count
If nPrinterCount > 0 Then
Dim dlgPrintPreview As New PrintPreviewDialog
dlgPrintDialog.PrinterSettings = prn.PrinterSettings
dlgPrintDialog.Document = prn
prn.PrinterSettings = dlgPrintDialog.PrinterSettings

If dlgPrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
'here i never comes because I always have cancel
With dlgPrintPreview
.Document = prn
.WindowState = FormWindowState.Maximized
.ShowInTaskbar = False
dlgPrintPreview.PrintPreviewControl.AutoZoom = False
dlgPrintPreview.PrintPreviewControl.Zoom = 1
.ShowDialog()
End With
End If
Else
MsgBox("No printer")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub 'sSetPrintVB
'---------end code-----------

From: JR on

"JR" <xx.x.x(a)xx.xx> schreef in bericht
news:lynGj.17166$ks2.3996(a)newsfet23.ams...
>
> "kimiraikkonen" <kimiraikkonen85(a)gmail.com> schreef in bericht
> news:2e6d0dc1-56da-4875-bf15-1062407a4d48(a)p73g2000hsd.googlegroups.com...
>> On Mar 26, 9:21 am, "JR" <xx....(a)xx.xx> wrote:
>>> Dim PrintDialog As New PrintDialog
>>> Dim result As DialogResult = PrintDialog.ShowDialog()
>>> If result = Windows.Forms.DialogResult.OK Then
>>> 'I get always cancel(2) as an result and nothing happens
>>> end if
>>>
>>> Why do I aways have cancel as an result. It shout popup but it doens on
>>> vista 64
>>>
>>> Thanxs
>>
>> JR,
>> Try This:
>>
>> If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
>> ' Code
>> End If
>>
>> And make sure, you've one printer installed at least.
> sorry,
> won't work
> still returns cancel
> I also added like you suggested a control of the printers. that returns
> (like it shout) 3
> this is the complete routine
> '---------start code-----------
> Public Sub sSetPrintVB(ByVal prn As Object)
> Dim dlgPrintDialog As New PrintDialog
> Try
> Dim nPrinterCount As Integer =
> System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count
> If nPrinterCount > 0 Then
> Dim dlgPrintPreview As New PrintPreviewDialog
> dlgPrintDialog.PrinterSettings = prn.PrinterSettings
> dlgPrintDialog.Document = prn
> prn.PrinterSettings = dlgPrintDialog.PrinterSettings
>
> If dlgPrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
> 'here i never comes because I always have cancel
> With dlgPrintPreview
> .Document = prn
> .WindowState = FormWindowState.Maximized
> .ShowInTaskbar = False
> dlgPrintPreview.PrintPreviewControl.AutoZoom = False
> dlgPrintPreview.PrintPreviewControl.Zoom = 1
> .ShowDialog()
> End With
> End If
> Else
> MsgBox("No printer")
> End If
> Catch ex As Exception
> MessageBox.Show(ex.Message)
> End Try
> End Sub 'sSetPrintVB
> '---------end code-----------
>

It seems to be a 64 bit problem.
This code works fine with XP 32 bit but on vista 64 or XP 64 it will not

Jan

From: kimiraikkonen on
On Mar 26, 10:33 am, "JR" <xx....(a)xx.xx> wrote:
> "JR" <xx....(a)xx.xx> schreef in berichtnews:lynGj.17166$ks2.3996(a)newsfet23.ams...
>
>
>
>
>
> > "kimiraikkonen" <kimiraikkone...(a)gmail.com> schreef in bericht
> >news:2e6d0dc1-56da-4875-bf15-1062407a4d48(a)p73g2000hsd.googlegroups.com...
> >> On Mar 26, 9:21 am, "JR" <xx....(a)xx.xx> wrote:
> >>> Dim PrintDialog As New PrintDialog
> >>> Dim result As DialogResult = PrintDialog.ShowDialog()
> >>> If result = Windows.Forms.DialogResult.OK Then
> >>> 'I get always cancel(2) as an result and nothing happens
> >>> end if
>
> >>> Why do I aways have cancel as an result. It shout popup but it doens on
> >>> vista 64
>
> >>> Thanxs
>
> >> JR,
> >> Try This:
>
> >> If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
> >> ' Code
> >> End If
>
> >> And make sure, you've one printer installed at least.
> > sorry,
> > won't work
> > still returns cancel
> > I also added like you suggested a control of the printers. that returns
> > (like it shout) 3
> > this is the complete routine
> > '---------start code-----------
> > Public Sub sSetPrintVB(ByVal prn As Object)
> > Dim dlgPrintDialog As New PrintDialog
> > Try
> > Dim nPrinterCount As Integer =
> > System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count
> > If nPrinterCount > 0 Then
> > Dim dlgPrintPreview As New PrintPreviewDialog
> > dlgPrintDialog.PrinterSettings = prn.PrinterSettings
> > dlgPrintDialog.Document = prn
> > prn.PrinterSettings = dlgPrintDialog.PrinterSettings
>
> > If dlgPrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
> > 'here i never comes because I always have cancel
> > With dlgPrintPreview
> > .Document = prn
> > .WindowState = FormWindowState.Maximized
> > .ShowInTaskbar = False
> > dlgPrintPreview.PrintPreviewControl.AutoZoom = False
> > dlgPrintPreview.PrintPreviewControl.Zoom = 1
> > .ShowDialog()
> > End With
> > End If
> > Else
> > MsgBox("No printer")
> > End If
> > Catch ex As Exception
> > MessageBox.Show(ex.Message)
> > End Try
> > End Sub 'sSetPrintVB
> > '---------end code-----------
>
> It seems to be a 64 bit problem.
> This code works fine with XP 32 bit but on vista 64 or XP 64 it will not
>
> Jan

Interesting with 64-bit. I wonder if it's a problem in framework or
operating system.