Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4271734
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:28:56+00:00 2026-05-21T07:28:56+00:00

I got this timer tick function: Private Sub controlTick(ByVal sender As Object, ByVal e

  • 0

I got this timer tick function:

Private Sub controlTick(ByVal sender As Object, ByVal e As EventArgs)
    Label2.Text = (Control.ModifierKeys = Keys.Control)
End Sub

That is supposed to make my label say “True” if I am currently holding down the Control key, and “False” if I am not.

But, how come my label is always “False”? What is interesting is that if I press the Control key at lighting speed a bunch of times I can see for a fraction of a second “True”, but immediately turns to “False”.

Timer ticks every 50ms.

I do not understand…. any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:28:57+00:00Added an answer on May 21, 2026 at 7:28 am

    I can’t reproduce the behavior you describe… I tried creating a new WinForms project, placed a Label control on the middle of the form, and added a Timer control.

    Whenever I press the Ctrl key, the label reads True. Otherwise, it reads False. Exactly the behavior you would expect to see. I don’t have to press anything at lightning speed.

    (Edit: It doesn’t break when more controls are placed on the form either. What are you doing differently?)

    My code looks like this:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        ' Start the timer
        Timer1.Enabled = True
    End Sub
    
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        ' Update the label
        Label1.Text = (Control.ModifierKeys = Keys.Control).ToString
    End Sub
    

    Only difference is that you’re apparently compiling without type checking enabled (Option Strict Off).
    I always prefer to code in VB.NET with this turned on (check your project’s Properties window), in which case you have to explicitly convert the boolean type to a string type using ToString.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got this line of code here but its not working. private void Button_Click(object sender,
Okay, so we've got this event. Awesome, right? We've also got a timer with
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too
ok so i got this setup: a midlet Gui extends Midlet{ private static Gui
I've got a timer that won't trigger the associated function when the time runs
I got this timer (timer2) and it runs every 60 seconds.. And I got
I've got this date time string: post[date] = 2007-07-18 10:03:19 I'd like to extract
I got this idea a long time ago when i saw an app do
Some time ago I got this error when building ANY Visual Studio Deployment project.
I've got a reasonably simple query (this time) that I need ALL the results

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.