Help and Support
 

powered byLive Search

BUG: SetFocus Changes CommandButton Value to True

Article ID:180762
Last Review:March 11, 2005
Revision:3.1
This article was previously published under Q180762
On This Page

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.

Back to the top

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
				

Back to the top

STATUS

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

Back to the top

MORE INFORMATION

Steps to Reproduce Behavior

1.Create a new Windows CE project in either Visual Basic or eMbedded Visual Basic. Form1 is created by default.
2.Add two CommandButtons to Form1.
3.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
					
4.Press the F5 key to run the project.
5.Click Command2 and note that a message box appears that indicates that the Value property of Command1 has been set to True.

Back to the top


APPLIES TO
Microsoft Windows CE Toolkit for Visual Basic 6.0
Microsoft eMbedded Visual Basic 3.0

Back to the top

Keywords: 
kbbug kbtoolkit kbpending KB180762

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.