Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with a Boardgame problem in VB

Options
  • 22-04-2006 5:26pm
    #1
    Registered Users Posts: 4,946 ✭✭✭


    Right, im having one of those little annoying pieces of code that works one minute, then when you add something to the code, it wont work, then when you take it out to the way it was before, it still doesnt work.

    Basicly lblColM is the piece on my boardgame, and when i press the arrow keys, he moves around the board accordingly. I've been adding code to the program to add to the game and now nothing will work at all... not even a simple piece of dice code! Can anyone help me out here? The Basic code is below. There is alot more to it, but this is the part that i need to get working.

    Public Class FrmBoard

    Dim PlayerPos As String

    Private Sub FrmBoard_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    lblColM.Top = 5
    lblColM.Left = 225
    End Sub

    Private Sub FrmBoard_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

    Select Case e.KeyCode
    Case Keys.Left 'If the left arrow key is pressed
    lblColM.Left = lblColM.Left - 25
    lblLeftRight.Text = lblColM.Left 'Shows pixel pos in lbl

    Case Keys.Up 'If the up arrow key is pressed
    lblColM.Top = lblColM.Top - 25
    lblUpDown.Text = lblColM.Top 'Shows pixel pos in lbl

    Case Keys.Right 'If the right arrow key is pressed
    lblColM.Left = lblColM.Left + 25
    lblLeftRight.Text = lblColM.Left 'Shows pixel pos in lbl

    Case Keys.Down 'If the down arrow key is pressed
    lblColM.Top = lblColM.Top + 25
    lblUpDown.Text = lblColM.Top 'Shows pixel pos in lbl
    End Select

    End Sub


Comments

  • Registered Users Posts: 4,276 ✭✭✭damnyanks


    Param names?

    Seems straight forward enough (Code above) so it must not be going in well with the rest of your code. Best thing to do is sit down with the debugger and run through what is and isn't happening.


Advertisement