Skip to content Skip to sidebar Skip to footer

vb how to tell what control has focus

  1. #1

    maged is offline

    Thread Starter

    Frenzied Member maged's Avatar


    is it possible to check if a certain command Has Focus???

    hi all

    is it possible to cheque that a certain command has the focus crusade i desire to practice something and then return back to the command the user was focusing on.

    is it possible, and as well is it possible to become the control that is already having the focus on the form????

    thx in advance

    RGDS


  2. #2

    MardiGras is offline

    New Fellow member


    Re: is information technology possible to check if a certain control Has Focus???

    Yes information technology is. Anything is possible. Side by side time enquire how to exercise it.

  3. #iii

    maged is offline

    Thread Starter

    Frenzied Fellow member maged's Avatar


    Re: is it possible to check if a certain control Has Focus???

    ok How???

  4. #4

    MardiGras is offline

    New Fellow member


    Re: is it possible to check if a certain control Has Focus???


  5. #5

    maged is offline

    Thread Starter

    Frenzied Member maged's Avatar


    Re: is it possible to cheque if a certain command Has Focus???


  6. #6

    MardiGras is offline

    New Member


    Re: is it possible to check if a sure control Has Focus???

    Rotflmao

    Private Sub btnAdd_GotFocus(ByVal sender As Object, ByVal e As Organization.EventArgs) Handles btnAdd.GotFocus

    End Sub

    Hmm you sure you using vb.cyberspace?


  7. #7

    maged is offline

    Thread Starter

    Frenzied Member maged's Avatar


    Re: is it possible to bank check if a certain control Has Focus???

    are u sure u sympathize oop programming

    what you lot brash me is an event handler , when i demand to cheque something i can't make if statement to check the event handler.

    i was asking if there is a property or method that could be checked to know if the control has focus.

    and i affair

    the code you lot have posted is Incorrect

    there is no event called gotfocus.

    whatsoever windows control triggers the ENTER issue when getting the user focus

    tin y'all sympathize what i mean ???


  8. #8

    Re: is it possible to cheque if a certain control Has Focus???

    VB Code:

                                      
    1. If Button1.Focused = True And then

    2.     MessageBox.Bear witness("Button1 was focused until I showed this msgbox!")

    3. Terminate If

    VB/Office Guru� (AKA: Gangsta Yoda )
    I dont answer coding questions via PM. Delight mail service a thread in the appropriate forum. Microsoft MVP 2006-2011
    Part Evolution FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .Cyberspace), BSEE, CET
    If a mail service has helped you then Please Rate information technology!
    Reps & Rating Posts VS.Net on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Role Guru� Give-and-take SpellChecker�.NETVB/Part Guru� Give-and-take SpellChecker� VB6VB.NET Attributes Ex.Outlook Global Address ListingAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.ii 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Function 2016, VS 2019, VB6 SP6


  9. #9

    MardiGras is offline

    New Fellow member


    Re: is it possible to check if a certain control Has Focus???

    Quote Originally Posted by maged

    hi all

    is information technology possible to cheque that a certain control has the focus cause i want to do something and and then return dorsum to the control the user was focusing on.

    is it possible, and too is it possible to get the control that is already having the focus on the form????

    thx in advance

    RGDS

    1. Yes I understand oop
    Your question was:

    is it possible to cheque that a sure command has the focus

    This is an result.

    the code you have posted is Wrong

    I copied and pasted the code from my ide.

    If that is not what you want then you actually need to make yourself more clear.


  10. #10

    maged is offline

    Thread Starter

    Frenzied Member maged's Avatar


    Re: is it possible to check if a certain command Has Focus???

    Oh people ,

    become serious . there is nothing called FOCUSED in Vb.net

    what are you talking about.


  11. #eleven

    maged is offline

    Thread Starter

    Frenzied Fellow member maged's Avatar


    Re: is it possible to check if a certain control Has Focus???

    ok lets be clear

    i want to ask the class who is having focus within you lot

    i need to know the command who accept focus on class 1

    is that Clear enought ???


  12. #12

    Re: is information technology possible to check if a certain control Has Focus???

    THAT is what the .Focused is for!

    Quote Originally Posted by MSDN

    .NET Framework Course Library

    Control.Focused PropertySee Also
    Control Course | Control Members | Organisation.Windows.Forms Namespace | CanFocus | Focus | CanSelect | ContainsFocus | Control Members (Visual J# Syntax) | Managed Extensions for C++ Programming
    Requirements
    Platforms: Windows 98, Windows NT iv.0, Windows Millennium Edition, Windows 2000, Windows XP Dwelling Edition, Windows XP Professional, Windows Server 2003 family, .Net Compact Framework - Windows CE .NET
    Language
    C#

    C++

    JScript

    Visual Basic

    Testify All
    Gets a value indicating whether the control has input focus.

    [Visual Basic]
    Public Overridable ReadOnly Property Focused As Boolean

    [C#]
    public virtual bool Focused {get;}

    [C++]
    public: __property virtual bool get_Focused();

    [JScript]
    public office get Focused() : Boolean;

    Property Value
    truthful if the control has focus; otherwise, fake.

    Remarks
    Notes to Inheritors: When overriding the Focused holding in a derived class, use the base form'due south Focused property to extend the base implementation. Otherwise, yous must provide all the implementation.

    Example
    [Visual Basic, C#, C++] The following example disables a MenuItem if a TextBox does not have focus. This example assumes you have a Form with a TextBox named textBox1 and two MenuItem objects named menuItemEdit and menuItemEditInsertCustomerInfo.

    [Visual Basic]
    Private Sub menuItemEdit_Popup(sender As Object, _
    e Equally EventArgs) Handles menuItemEdit.Popup
    ' Disable the menu item if the text box does non have focus.
    Me.menuItemEditInsertCustomerInfo.Enabled = Me.textBox1.Focused
    Terminate Sub

    [C#]
    private void menuItemEdit_Popup(object sender, EventArgs e)
    {
    // Disable the menu item if the text box does not take focus.
    this.menuItemEditInsertCustomerInfo.Enabled = this.textBox1.Focused;
    }

    [C++]
    private:
    void menuItemEdit_Popup(Object* /*sender*/, EventArgs* /*east*/) {
    // Disable the bill of fare item if the text box does not have focus.
    this->menuItemEditInsertCustomerInfo->Enabled = this->textBox1->Focused;
    }

    [JScript] No example is available for JScript. To view a Visual Bones, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.

    Requirements
    Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Habitation Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET

    Encounter As well
    Control Form | Control Members | System.Windows.Forms Namespace | CanFocus | Focus | CanSelect | ContainsFocus | Control Members (Visual J# Syntax) | Managed Extensions for C++ Programming

    Syntax based on .Internet Framework version 1.1.
    Documentation version 1.1.0.

    --------------------------------------------------------------------------------

    Send comments on this topic.

    � 2001-2002 Microsoft Corporation. All rights reserved.

    VB/Office Guru� (AKA: Gangsta Yoda )
    I dont answer coding questions via PM. Please mail service a thread in the advisable forum. Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB half-dozen, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .Internet), BSEE, CET
    If a mail has helped y'all then Delight Rate information technology!
    Reps & Rating Posts VS.NET on Vista Multiple .Net Framework Versions Part Main Interop AssembliesVB/Office Guru� Word SpellChecker�.NetVB/Role Guru� Word SpellChecker� VB6VB.Net Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung K.two one TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6


  13. #xiii

    maged is offline

    Thread Starter

    Frenzied Member maged's Avatar


    Re: is it possible to check if a certain control Has Focus???

    RobDog888 YOU ARE RIGHT AND I WAS WRONG

    there is something going incorrect with my IDE intellisense, it doesen't show the focused property but when i typed it completely it worked and it is boolean.

    well RobDog888 i was wrong again and i am sorry for the disturbance

    c u

    rgds


  14. #fourteen

    Re: is it possible to check if a certain command Has Focus???

    No prob.

    Y'all probably deceit come across it in the intellisense because yous may take your ide
    settings to hibernate advanced members (default). Uncheck it and you will have all the
    intellisense y'all want.

    VB/Part Guru� (AKA: Gangsta Yoda )
    I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011
    Function Development FAQ (C#, VB.Internet, VB half-dozen, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating Posts VS.Cyberspace on Vista Multiple .Net Framework Versions Role Primary Interop AssembliesVB/Role Guru� Word SpellChecker�.NetVB/Office Guru� Word SpellChecker� VB6VB.NET Attributes Ex.Outlook Global Accost ListAPI Viewer utility.Internet API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Function 2016, VS 2019, VB6 SP6


  15. #15

    maged is offline

    Thread Starter

    Frenzied Member maged's Avatar


    Re: is information technology possible to cheque if a certain control Has Focus???

    well Strange,

    what is avant-garde most FOCUSED Property !!!!

    i dont know but sometimes microsoft categorizes things in a very strange gild.

    but thank you for everything


  16. #xvi

    Re: is it possible to check if a sure control Has Focus???

    Dont know, but its in the tips sticky at the tiptop of the vb.internet forum for detailed instructions on how to show all.

    I take know thought why you would always want to limit a developer from using all the tools.

    VB/Office Guru� (AKA: Gangsta Yoda )
    I dont respond coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011
    Office Evolution FAQ (C#, VB.Cyberspace, VB half-dozen, VBA)
    Senior Jedi Software Engineer MCP (VB vi & .Net), BSEE, CET
    If a postal service has helped y'all then Please Rate it!
    Reps & Rating Posts VS.NET on Vista Multiple .Net Framework Versions Office Primary Interop AssembliesVB/Office Guru� Word SpellChecker�.NETVB/Office Guru� Discussion SpellChecker� VB6VB.Cyberspace Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 ane TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, ii Viewsonic 24" LCDs, Windows 10, Function 2016, VS 2019, VB6 SP6


  17. #17

    maged is offline

    Thread Starter

    Frenzied Fellow member maged's Avatar


    Re: is information technology possible to check if a certain control Has Focus???

    I have know idea why you would e'er want to limit a programmer from using all the tools.


    Hold

Posting Permissions

  • Yous may non post new threads
  • You may non post replies
  • You may not post attachments
  • You may not edit your posts
  • BB lawmaking is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML lawmaking is Off

Click Here to Expand Forum to Full Width

shermanthelikin.blogspot.com

Source: https://www.vbforums.com/showthread.php?329735-is-it-possible-to-check-if-a-certain-control-Has-Focus

Post a Comment for "vb how to tell what control has focus"