• Advertisement

Archived

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

how do i check if a control has got focus?

This topic is 5849 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
Advertisement
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
Next

End Sub

Share this post


Link to post
Share on other sites

  • Advertisement