BUG: CommonDialog FilterIndex Always Returns Default Filter Index (232654)



The information in this article applies to:

  • Microsoft Windows CE Toolkit for Visual Basic 6.0

This article was previously published under Q232654

SYMPTOMS

The FilterIndex property of the CommonDialog control that ships with the Microsoft Windows CE Toolkit for Visual Basic 6.0 (VBCE6) will always return the index for the first defined filter despite being changed by the user at run time.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

The following code will behave differently between VBCE and Visual Basic 6.0.

Steps to Reproduce Behavior

  1. Start a new Windows CE HPC Project in Visual Basic.
  2. Select Components from the Project menu and reference the Microsoft CE Common Dialog Control 6.0.
  3. Add a Common dialog and a Command Button to Form1.
  4. Paste the following code into Form1:
    Private Sub Command1_Click()
        CommonDialog1.Filter = "Text (*.txt)|*.txt|Pictures (*.bmp)|*.bmp"
        CommonDialog1.FilterIndex = 1
        CommonDialog1.ShowOpen
        
        MsgBox "FilterIndex: " & CommonDialog1.FilterIndex
    End Sub
    					
  5. Run the project and click the Command Button.
  6. Select a text file to open and notice that the message box will display "FilterIndex: 1."
  7. Click the Command Button again and select a bitmap file to open. Notice that the message box will again display "FilterIndex: 1," when it should display "FilterIndex: 2." This is inconsistent with how the Visual Basic 6.0 CommonDialog control works where the FilterIndex will reflect the user's selection.

REFERENCES

Visual Basic 6.0 Online Help
Windows CE Toolkit for Visual Basic 6.0 Online Help

Modification Type:MinorLast Reviewed:8/19/2005
Keywords:kbBug kbpending kbToolkit KB232654