Array mit Namen und Daten

Type, Array
Const pmax = 10
Private persList(1 To pmax) As TPerson
Private pos%
Private Type TPerson
  name As String * 20
  geburt As Integer
  student As Boolean
End Type
Private Sub cmdEnde_Click()
  Unload Me
End Sub
Private Sub cmdEnde_LostFocus()
  txtName.Text = ""
End Sub
Private Sub Form_Load()
Dim i%
   pos = 1
   For i = pmax To 1 Step -1
    With persList(i)
     .name = "Maier"
     .geburt = 1950
     .student = True
     End With
   Next i
   Me.Show
   Call anzeigen
End Sub
Sub speichern()
   persList(pos).name = txtName.Text
   If txtJahr.Text <> "" Then persList(pos).geburt = Val(txtJahr.Text)
   persList(pos).student = -chk1.Value
End Sub
Sub anzeigen()
   Call fehler
   txtNr.Text = Str$(pos)
   txtName.Text = persList(pos).name
   txtJahr.Text = Str$(persList(pos).geburt)
   chk1.Value = -persList(pos).student
End Sub
Private Sub cmdVor_Click()
   Call fehler
   If pos < pmax Then Call speichern
   pos = pos + 1
   Call anzeigen
End Sub
Private Sub cmdRueck_Click()
   Call fehler
   If pos > 1 Then Call speichern
   pos = pos - 1
   Call anzeigen
End Sub
Private Sub txtJahr_GotFocus()
   txtJahr.Text = ""
End Sub
Private Sub fehler()
   If pos < 1 Or pos > 10 Then
    MsgBox "Kein Platz mehr im Array"
    pos = 1
   End If
End Sub



 Ranking-Hits zurück Sitemap
Designed by www.wbrnet.info