BUG: SetFocus Changes CommandButton Value to True
ID: Q180762
|
The information in this article applies to:
-
Microsoft Windows CE Toolkit for Visual Basic 6.0
-
Microsoft Windows CE Toolkit for Visual Basic 5.0
SYMPTOMS
When the Value property of a CommandButton is set to False and the SetFocus
method of the CommandButton is executed, the CommandButton Value property
is set to True.
RESOLUTION
Set the Value property of the CommandButton to False after the SetFocus
method is called, as follows:
Private Sub Command2_Click()
If Command1.Value = False Then
Command1.SetFocus ' Set focus to Command1.
Command1.Value = False ' Set the Value property back to False.
MsgBox "Command1.Value = " & Command1.Value
Else
Command1.SetFocus 'Set focus to Command1.
End If
End Sub
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new Windows CE (HPC) Project in Visual Basic. Form1 is created by default.
- Add two CommandButtons to Form1.
- Add the following code to Form1:
Private Sub Form_Load()
Command1.Value = False
MsgBox "Command1.Value = " & Command1.Value
End Sub
Private Sub Command2_Click()
Command1.SetFocus
MsgBox "Command1.Value = " & Command1.Value
End Sub
- Press the F5 key to run the project.
- Click Command2 and note that a message box appears that indicates
that the Value property of Command1 has been set to True.
Additional query words:
wince wce vbce vbce5 vbce6
Keywords : kbToolkit kbVBp500bug kbVBp600bug kbWinCE100bug kbGrpVB
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug