Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


how do i check if a control has got focus?

This topic is 6026 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m adding a cut copy paste button for my form (in Visual Basic). Cutting is simple enough I cycle through every control if it''s a form and it''s got highlighted text then add it to the clipboard. Pasting however is harder I cycle through every control and check which control has got focus, and use the clipboard gettext method. How do I check if it''s got focus?

Share this post

Link to post
Share on other sites
Nope. Doesn''t show up as a property or method. Here''s the code it might help:


Public Sub Paste()

Dim iControl As Control

''cycle through every control
For Each iControl In frmHospital.Controls
''if the control is a textbox
If TypeOf iControl Is TextBox Then
If iControl.checkifit''sgotfocushere Then
''paste it
End If
End If

End Sub

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!