Inputs in Visual Basic 2008?(resolved)

Started by G_G, March 08, 2009, 11:52:53 am

Previous topic - Next topic

G_G

March 08, 2009, 11:52:53 am Last Edit: April 10, 2009, 02:54:24 am by game_girl
Okay well I had an idea for something. But I need inputs. What would I type in for an input?
Example what would I type if I wanted something to happen when teh Up Arrow has been pressed.

Tazero

Here...
Let me see


  'INKEY.BAS  - how to use the Inkey$ variable

  open "Inkey$ example" for graphics as #graph
  print #graph, "when characterInput [fetch]"

[mainLoop]
  print #graph, "setfocus"
  input r$

[fetch]  'a character was typed!

  key$ = Inkey$
  if len(key$) = 1 then
      notice key$+" was pressed!"
  else
      keyValue = asc(right$(key$, 1))
      if keyValue = _VK_SHIFT then
          notice "Shift was pressed"
        else
          if keyValue = _VK_CONTROL then
              notice "Ctrl was pressed"
            else
              notice "Unhandled key pressed"
          end if
      end if
  end if

  goto [mainLoop]



Try something along those lines


If you were a fish...

G_G

*BUMP*
Meta that helps in no way of form :P
I guess this is kind of worthless but please can someone help if they know?

G_G

Mwahaha I figured it out  :evil:
It was this all along!!!!
Private Sub Map_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.Left
                Label1.Text = Val(Label1.Text) - 2
                PictureBox1.Location = New System.Drawing.Point(Val(Label1.Text), Val(Label2.Text))
            Case Keys.Right
                Label1.Text = Val(Label1.Text) + 2
                PictureBox1.Location = New System.Drawing.Point(Val(Label1.Text), Val(Label2.Text))
            Case Keys.Up
                Label2.Text = Val(Label2.Text) - 2
                PictureBox1.Location = New System.Drawing.Point(Val(Label1.Text), Val(Label2.Text))
            Case Keys.Down
                Label2.Text = Val(Label2.Text) + 2
                PictureBox1.Location = New System.Drawing.Point(Val(Label1.Text), Val(Label2.Text))
            Case Keys.X
                Stats.Show()
                Me.Close()
        End Select
    End Sub


Resolved!