Results 1 to 4 of 4

Thread: What exactly do e.keychar and e.handle mean?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Posts
    88

    What exactly do e.keychar and e.handle mean?

    I use these 2 terms a lot in my code. I think e.handle is Error Handler? But I don't know what Key Char is. So if I had the code:
    VB Code:
    1. If Char.IsNumber(e.keychar) = False andalso Char.IsControl(e.keychar) = False Then
    2.    e.handled = true
    3. End if

    Could someone explain each part of this line of code to me? I really don't understand it, and I really want to understand it.

    Thanks

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: What exactly do e.keychar and e.handle mean?

    Try to look at msdn
    Link at my signature

    Look Here For Both Property


  3. #3
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: What exactly do e.keychar and e.handle mean?

    e.KeyChar is the char that was pressed on the keyboard, if you set e.Handled to true that means you've handled the event yourself and dont need the control to finish handling the event
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: What exactly do e.keychar and e.handle mean?

    e is the argument passed in to the event. For the KeyPress event e can determine the key being pressed. Also, e.Handled = True means to cancel the event or that your handling the event in your code instead.


    VB Code:
    1. ... e As System.Windows.Forms.[b]KeyPressEventArgs[/b]
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET 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, Office 2016, VS 2019, VB6 SP6

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