rjmccorkle
Programmer
I'm using VB6. In some of the code I wrote, the shortcut key for a command control does not cause all of the code in the Click_event to be executed; some does and some doesn't. If I throw in a msgbox the all code executes. If I step thru the code in debug mode it all executes. Clicking with the mouse works OK. I've noticed that it doesn't execute the Lost_Focus events when shortcut keys are used also.
Here is the code. The <<lblID.caption="-1">> is what I noticed the shortcut key won't execute but the mouse click does:
Private Sub cmdChAdd_Click()
Dim vF As Integer
vgResult = MsgBox("Add New Client?", vbOKCancel)
If vgResult <> vbOK Then Exit Sub
'use Tag to go back to current Child in case of cancel
lblID.Tag = lblID.Caption
cboChName.Text = ""
cboSSN.ListIndex = -1
For vF = 0 To txtChild.Count - 1
txtChild(vF).Text = ""
Next vF
chkRespite.Value = 0
For vF = 0 To cboChild.Count - 1
cboChild(vF).ListIndex = -1
cboChild(vF).Tag = -1
Next vF
txtChild(0).SetFocus
'use Tag to go back to current Child in case of cancel
If lblID.Caption > "0" Then
lblID.Tag = lblID.Caption
Else
lblID.Tag = 0
End If
'set CID to -1 to indicate adding new
lblID.Caption = "-1"
Call SetState("ChildEdit"
lblEdit.Caption = "Adding NEW"
lblEdit.Tag = "NEW"
'set focus back to where it was right before clicking Edit
If vEditFocus > 99 Then
cboChild(vEditFocus - 100).SetFocus
Else
txtChild(vEditFocus).SetFocus
End If
End Sub
I tried a simple project of a command button with shortcut key and a label and have the command click_event change the label caption. It works with the shortcut or the mouse.
Thanks for any help.
Bob
104122.315@compuserve.com [sig][/sig]
Here is the code. The <<lblID.caption="-1">> is what I noticed the shortcut key won't execute but the mouse click does:
Private Sub cmdChAdd_Click()
Dim vF As Integer
vgResult = MsgBox("Add New Client?", vbOKCancel)
If vgResult <> vbOK Then Exit Sub
'use Tag to go back to current Child in case of cancel
lblID.Tag = lblID.Caption
cboChName.Text = ""
cboSSN.ListIndex = -1
For vF = 0 To txtChild.Count - 1
txtChild(vF).Text = ""
Next vF
chkRespite.Value = 0
For vF = 0 To cboChild.Count - 1
cboChild(vF).ListIndex = -1
cboChild(vF).Tag = -1
Next vF
txtChild(0).SetFocus
'use Tag to go back to current Child in case of cancel
If lblID.Caption > "0" Then
lblID.Tag = lblID.Caption
Else
lblID.Tag = 0
End If
'set CID to -1 to indicate adding new
lblID.Caption = "-1"
Call SetState("ChildEdit"
lblEdit.Caption = "Adding NEW"
lblEdit.Tag = "NEW"
'set focus back to where it was right before clicking Edit
If vEditFocus > 99 Then
cboChild(vEditFocus - 100).SetFocus
Else
txtChild(vEditFocus).SetFocus
End If
End Sub
I tried a simple project of a command button with shortcut key and a label and have the command click_event change the label caption. It works with the shortcut or the mouse.
Thanks for any help.
Bob
104122.315@compuserve.com [sig][/sig]