ToolStripButton and PrintDialog (Vb.NET Beta2)


I find the Print Dialog Box is not in activate when fired by button on ToolStrip, like:


PrivateSub ToolStripButton1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles ToolStripButton1.Click
PrintDialog1.ShowDialog()
EndSub


The printDialog has to be made active by clicking once before making any print options.

However, it is alright by normal buton, like:


PrivateSub Button1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles Button1.Click
PrintDialog1.ShowDialog()
EndSub

Is this abug or not? Thanks.

[2146 byte] By [jiao] at [2007-12-24]
# 1

Hi,

Just tried it and it worked perfect. Could you try specifying your owner form to one of the parameters of the showdialog method:


Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
PrintDialog1.ShowDialog(Me)
End Sub

cheers,

Paul June A. Domag

PaulDomag at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
Thanks for your reply.

I just tried, it still does not work. I am wondering why?

jiao at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3

Hi,

Is there an error happening? Or is it just that it doesn't gain focus? Could you try it in a new project? Maybe your doing something before showing the printdialog that causes it to lose focus...

cheers,

Paul June A. Domag

PaulDomag at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4
Hi Paul:

Yes. I tried in a new project. I just add a TooStrip with a button on it; a PrintDialog and a PrintDocument. No error message, it just does not gain focus, but it is very annoying. I can not figure out why.

Many thanks.

jiao at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5

Hi,

I really have a problem reproducing your problem. Try Running the exe maybe it has a difference, here is my code on displaying the printdialo in 2005:

private void toolStripButton1_Click(object sender, EventArgs e) {
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
pd.ShowDialog();
}

cheers,

Paul June A. Domag

PaulDomag at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 6
Hi Paul,

Thanks a lot. Runing exe file is the same. I am sure there is a problem. I have put the simple project I created http://home.iprimus.com.au/jiaohui/vb.net/windowsapplication1.zip
It would be appreciated if you can give it a test run.

I also put the recorded screen video when creating and runing the project on my machine http://home.iprimus.com.au/jiaohui/vb.net/1.avi
Look the mouse difference on PrintDialog fired from different button.

Thanks.

jiao at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 7

Hi,

This indeed is a BUG. Im not quite sure if this is already fixed in the RC. Im still using Beta 2. Try reporting this to Microsoft Feedback Center. And please keep us posted...

cheers,

Paul June A. Domag

PaulDomag at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 8
I have the same problem in final-version of .NET 2.0.

When I add my code to a normal Button it works fine.

But when I call printdialog.showdialog() from a toolstrip-button the form is not active :-(.

Is it a confirmed Bug? Does there exist any workaround?
MrNice01 at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 9

Hi,

Yep. I guess this is in their lower priority list. Since there are more critical fixes needed to be done in VS2005. But you can wait for the VS2005 SP1. Maybe they'll include the fix in this release.

cheers,

Paul June A. Domag

PaulDomag at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...