Here is little easy hack I just made that you could use.
To use it all you need to do is call the function on the checkbox_mousedown, better if you use array.Code:Private Function RemoveFocus(ChkBox As CheckBox) Static FakeButton As CommandButton If FakeButton Is Nothing Then Set FakeButton = Controls.Add("VB.CommandButton", "FakeButton") With FakeButton .Move -300, -300, 30, 30 .Visible = True End With End If With ChkBox If .Value = vbChecked Then .Value = vbUnchecked Else .Value = vbChecked End With FakeButton.SetFocus End Function
Example 1 (Array)
Code:Private Sub Check1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) RemoveFocus Check1(Index) End Sub
Example 2 (regular, non-array)
Note: Do not add to the CheckBox_Click event because it will cause 'Out of stack space' error.Code:Private Sub Check2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) RemoveFocus Check2 End Sub




Reply With Quote