ich hebe ein progremirfehler denn ich nicht finde
mit visual basic 2010
code:
Imports System.ComponentModel
Public Class Form1
Dim jmax As Integer = 10
Dim j As Integer = 2
Dim hallo As String = "s"
Private Sub w_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles w.Click
hallo = "w"
End Sub
Private Sub s_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles s.Click
hallo = "s"
End Sub
Private Sub d_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles d.Click
hallo = "d"
End Sub
Private Sub a_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles a.Click
hallo = "a"
End Sub
Private Sub start_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles start.Click
j = InputBox("geswindichkeit")
If j > jmax Then
Dim h = MsgBox("einen wert gleiner als 10")
j = InputBox("geswindichkeit")
End If
Timer1.Enabled = True
End Sub
Private Sub Buttonstop_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Buttonstop.Click
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
neu(hallo)
If neu(hallo) = 0 Then
If pbmove.Location.Y < 1 Then
pbmove.Location = New Point(pbmove.Location.X, pbmove.Location.Y +
50)
ElseIf pbmove.Location.Y > 2000 Then
pbmove.Location = New Point(pbmove.Location.X, pbmove.Location.Y -
50)
ElseIf pbmove.Location.X < 1 Then
pbmove.Location = New Point(pbmove.Location.X + 50,
pbmove.Location.Y)
ElseIf pbmove.Location.X > 2500 Then
pbmove.Location = New Point(pbmove.Location.X - 50,
pbmove.Location.Y)
End If
Else
End If
End Sub
Function neu(ByVal hallo As String)
Try
Return 1
If hallo = "s" Then
pbmove.Location = New Point(pbmove.Location.X, pbmove.Location.Y + j)
ElseIf hallo = "d" Then
pbmove.Location = New Point(pbmove.Location.X + j, pbmove.Location.Y)
ElseIf hallo = "w" Then
pbmove.Location = New Point(pbmove.Location.X, pbmove.Location.Y - j)
ElseIf hallo = "a" Then
pbmove.Location = New Point(pbmove.Location.X - j, pbmove.Location.Y)
Else
pbmove.Location = New Point(pbmove.Location.X, pbmove.Location.Y + 2)
End If
Catch ex As Exception
Return 0
End Try
End Function
End Class