ich hab mal eine kleine Inventar add Item Funktion geschrieben und wollt mal fragen ob das so recht dumm gelöst oder doch ganz ok:
Form mit den Items:
Code:
Public Class Items
Private Sub Items_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.Show()
End Sub
Private Sub Itm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Itm2.Click
Itm2.Visible = False
Form2.Items.SelectedIndex = 0
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 1
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 2
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 3
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 4
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 5
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 6
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 7
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 8
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 9
If Form2.Items.SelectedItem = "1" Then
Else
Form2.Slot10.BackColor = Color.Blue
End If
Else
Form2.Slot9.BackColor = Color.Blue
End If
Else
Form2.Slot8.BackColor = Color.Blue
End If
Else
Form2.Slot7.BackColor = Color.Blue
End If
Else
Form2.Slot6.BackColor = Color.Blue
End If
Else
Form2.Slot5.BackColor = Color.Blue
End If
Else
Form2.Slot4.BackColor = Color.Blue
End If
Else
Form2.Slot3.BackColor = Color.Blue
End If
Else
Form2.Slot2.BackColor = Color.Blue
End If
Else
Form2.Slot1.BackColor = Color.Blue
End If
End Sub
Private Sub Itm3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Itm3.Click
Itm3.Visible = False
Form2.Items.SelectedIndex = 0
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 1
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 2
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 3
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 4
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 5
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 6
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 7
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 8
If Form2.Items.SelectedItem = "1" Then
Form2.Items.SelectedIndex = 9
If Form2.Items.SelectedItem = "1" Then
Else
Form2.Slot10.BackColor = Color.Red
End If
Else
Form2.Slot9.BackColor = Color.Red
End If
Else
Form2.Slot8.BackColor = Color.Red
End If
Else
Form2.Slot7.BackColor = Color.Red
End If
Else
Form2.Slot6.BackColor = Color.Red
End If
Else
Form2.Slot5.BackColor = Color.Red
End If
Else
Form2.Slot4.BackColor = Color.Red
End If
Else
Form2.Slot3.BackColor = Color.Red
End If
Else
Form2.Slot2.BackColor = Color.Red
End If
Else
Form2.Slot1.BackColor = Color.Red
End If
End Sub
End Class
Code:
Public Class Inventar
Dim s1 As Integer
Dim s2 As Integer
Dim s3 As Integer
Dim s4 As Integer
Dim s5 As Integer
Dim s6 As Integer
Dim s7 As Integer
Dim s8 As Integer
Dim s9 As Integer
Dim s10 As Integer
Private Sub ItemsC_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItemsC.Tick
Items.Items.Clear()
Items.Items.Add(s1)
Items.Items.Add(s2)
Items.Items.Add(s3)
Items.Items.Add(s4)
Items.Items.Add(s5)
Items.Items.Add(s6)
Items.Items.Add(s7)
Items.Items.Add(s8)
Items.Items.Add(s9)
Items.Items.Add(s10)
End Sub
Private Sub Slot1_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot1.BackColorChanged
s1 = 1
End Sub
Private Sub Slot2_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot2.BackColorChanged
s2 = 1
End Sub
Private Sub Slot3_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot3.BackColorChanged
s3 = 1
End Sub
Private Sub Slot4_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot4.BackColorChanged
s4 = 1
End Sub
Private Sub Slot5_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot5.BackColorChanged
s5 = 1
End Sub
Private Sub Slot6_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot6.BackColorChanged
s6 = 1
End Sub
Private Sub Slot7_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot7.BackColorChanged
s7 = 1
End Sub
Private Sub Slot8_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot8.BackColorChanged
s8 = 1
End Sub
Private Sub Slot9_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot9.BackColorChanged
s9 = 1
End Sub
Private Sub Slot10_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Slot10.BackColorChanged
s10 = 1
End Sub
End Class






