Adblock breaks this site

Quick Question

Discussion in 'Archives' started by bad_moose, Feb 25, 2010.

Thread Status:
Not open for further replies.
  1. bad_moose

    bad_moose Guru

    Joined:
    Jul 31, 2008
    Posts:
    1,305
    Referrals:
    0
    Sythe Gold:
    0
    Quick Question

    Hello everyone, I was just wondering how I would go about making it so a button which currently performs an action will perform the same action if I press the enter key instead? I am using Visual Basic 2008 express edition. Could someone also tell me what the dimensions of a normal window are? (EG, full size window on google chrome) Thanks :)
     
  2. Visual Basic Matt

    Visual Basic Matt Apprentice

    Joined:
    Jan 29, 2008
    Posts:
    647
    Referrals:
    2
    Sythe Gold:
    56
    Discord Unique ID:
    223154494878253056
    Quick Question

    To detect enter keypress you can use a timer which will check if the key is pressed and then click the button within code. Or you can place the code inside the if statement.

    Code:
    If e.KeyCode = Keys.Enter Then
    Button1.PerformClick()
    end if
    A full sized window can really depend on the computers resolution. If you want to get the dimensions of the users full sized window you can use.
    Code:
            Dim DimensionX
            Dim DimensionY
            'Put window in its maximized state
            Me.WindowState = FormWindowState.Minimized
            'Grab width and height of window
            dimensionx = Me.Width
            DimensionY = Me.Height
     
  3. bad_moose

    bad_moose Guru

    Joined:
    Jul 31, 2008
    Posts:
    1,305
    Referrals:
    0
    Sythe Gold:
    0
    Quick Question

    Thanks Matt :)
     
  4. vbpro

    vbpro Member
    Banned

    Joined:
    Apr 20, 2010
    Posts:
    91
    Referrals:
    0
    Sythe Gold:
    0
    Quick Question

    Its a hotkey so as matt said its

    if e.keycode = keys.enter then
    Button1.Performclick ()
    end if
     
< Help | VB6 Login forms... >
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site