Results 1 to 6 of 6

Thread: console app and determining witch key was pressed

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    3

    console app and determining witch key was pressed

    Hi !
    i have problem with console app
    how to determine witch key was pressed and do some action for it ex:

    1. start the app
    2. waiting for user action
    3. pressing a key ( ex F3 )
    4. app make an action
    5. waiting for user action
    [...]


    can someone help me ? from 2 days i can't find anything about this ...

    thx for replies !

    p.s. i don't mean something like this:
    VB Code:
    1. asciiCode = CInt(Console.Read())  ' Returns the ascii code of the entered character
    2.  
    3.             ' 13 is the code for enter
    4.             If asciiCode = 13 Then
    5.                 Exit Do
    6.             End If
    but something with KeyDown ( if it's possible )

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: console app and determining witch key was pressed

    Use the form KeyDown event... ex. Form1_KeyDown

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: console app and determining witch key was pressed

    The user interface that you see when you run a console app has nothing to do with your app. That interface is provided by the OS, so events related to the window mean nothing to your app. Your app doesn't even know there is a GUI, as the idea behind console apps is that they don't need one. All it has to interact with the world are three streams: stdin, stdout and stderr. They are the only (normal) ways to get data into and out of a console app. If you want GUI-related events then I suggest you create a Windows app and provide a TextBox that your user can use in the same way as they would use a command window.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    3

    Re: console app and determining witch key was pressed

    no, it's console application without any GUI
    i heard that i should use overloads, but i don't know how to do this,
    i did't find any example of it

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: console app and determining witch key was pressed

    Overloads of what?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    3

    Re: console app and determining witch key was pressed

    sorry for late answer, i work a lot ( in poland i have to )

    jmcilhinney i don't know, on polish forum about vb.net someone just tell me that i should use overloads, i'm newbe and i don't even know what's this
    I just look for simple example of using keyboard shortcuts in console application
    like ctrl+a or F5

    thx, and sorry for late answer

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