Microsoft KB Archive/194772

= BUG: SaveFileDialog.showDialog Fails at Head of Empty if Block =

Article ID: 194772

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Java Virtual Machine

-



This article was previously published under Q194772



SYMPTOMS
The Save File dialog box does not appear when a SaveFileDialog.showDialog call is placed in the conditional expression of an if statement that is followed by an empty if code block.



RESOLUTION
Place a line of code in the if block or following the if statement such as the following: if(...) int localint = 0;

-or-

if(...) { int localint = 0; }



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Virtual Machines 3165 and later.



Steps to Reproduce Behavior
 Save and compile the following code. Uncomment "int localint = 0;" to see the Save File dialog box.'  Leave "int localint = 0;" commented to reproduce the behavior. import com.ms.wfc.ui.*; import com.ms.win32.*; public class SFDialogTest { public static void main(String args[]) {

SaveFileDialog sfd = new SaveFileDialog; if (sfd.showDialog == DialogResult.OK) { //int localint = 0; }   String message = "SaveFileDialog should have been shown by now."; message += "\r\n"; message += "If not, Uncomment the \"int localint = 0;\" line "; message += "to make it work."; User32.MessageBox(0,   message,    "Message Box",    MessageBox.OK); } }



