Results 1 to 5 of 5

Thread: Turning a Boolean FALSE if the right KeyData isn't pressed.

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2010
    Posts
    36

    Turning a Boolean FALSE if the right KeyData isn't pressed.

    Hey! Me again! A week or so ago, you folks really taught me how to use the KeyData event. I adopted some of the coding to make my new code so much better. A few days ago, I thought I figured out how to run my little game. You see, you have two buttons. Comment and Uncomment. You Press Control + K and then after that, you press Control + (C or U) to activate the buttons. And I thought it worked! But my buddy figured out how to break it! The thing is, I need to figure out a way to make IsCtrlK (Look below) False if any key that isn't Control + C or U is pressed right after it. What would you suggest I look into using?

    Here is the code.

    Code:
        Dim IsCtrlK As Boolean
            Select Case e.KeyData
                Case Keys.Control Or Keys.K
                    IsCtrlK = True
            End Select
            If IsCtrlK = True Then
                Select Case e.KeyData
                    Case Keys.Control Or Keys.C
                        ToolstripButtonCommentText.PerformClick()
                        IsCtrlK = False
                    Case Keys.Control Or Keys.U
                        ToolstripButtonUncommentText.PerformClick()
                        IsCtrlK = False
                End Select
            End If
    Last edited by kleinma; Aug 2nd, 2010 at 12:33 PM. Reason: formatted code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width