
Originally Posted by
Ebiru
VB Code:
Private Sub cmdmmove_KeyPress(KeyAscii As Integer)
If KeyAscii = 97 And picleftmale.Visible = True Then
frmupchar.Left = frmupchar.Left - 100
picleftmale.Visible = True
picbackmale.Visible = False
picfrontmale.Visible = False
ElseIf KeyAscii = 115 And picleftmale.Visible = True Then
frmupchar.Top = frmupchar.Top + 100
picfrontmale.Visible = True
picleftmale.Visible = False
picbackmale.Visible = False
ElseIf KeyAscii = 100 And picleftmale.Visible = True Then
frmupchar.Left = frmupchar.Left + 100
ElseIf KeyAscii = 119 And picleftmale.Visible = True Then
frmupchar.Top = frmupchar.Top - 100
picbackmale.Visible = True
picleftmale.Visible = False
picfrontmale.Visible = False
End If
that code is to make the frm move but the problem is it doesnt want to move anymore. maybe its bacause i have a **** load of stuff on the form. im not sure but ill leave the form so u can take a look
That would be better written like
VB Code:
If picleftmale.Visible = True Then
Select Case KeyAscii
Case 97
frmupchar.Left = frmupchar.Left - 100
picleftmale.Visible = True
picbackmale.Visible = False
picfrontmale.Visible = False
Case 115
frmupchar.Top = frmupchar.Top + 100
picfrontmale.Visible = True
picleftmale.Visible = False
picbackmale.Visible = False
Case 100
frmupchar.Left = frmupchar.Left + 100
Case 119
frmupchar.Top = frmupchar.Top - 100
picbackmale.Visible = True
picleftmale.Visible = False
picfrontmale.Visible = False
End Select
End If