Hi
Ich wollte mir die Wochentage anzeigen lassen, wenn ich das Datum eingebe. Aber das funzt nicht, könnt ihr mir sagen wo der Fehler liegt? Später will ich daraus meinen Bus anzeigen lassen wenn man Datum und Uhrzeit eingibt. Naja egal(nur zur erläuterung)
Für Hilfe wär ich echt dankbar!
Dim Monatstage As Long, Monat As Long, Tage As Long, Quotient As Long, Produkt As Long, Rest As Long, AnzahlTage As Long
Private Sub cmd_Ende_Click()
End
End Sub
Private Sub cmd_Loeschen_Click()
txt_Tag = ""
txt_Monat = ""
txt_Jahr = ""
lbl_Wochentag = ""
lbl_Datum = ""
lbl_Quotient = ""
lbl_Produkt = ""
lbl_Rest = ""
End Sub
Private Sub cmd_Ok_Click()
If txt_Monat < 1 Or txt_Monat > 12 Or txt_Tag < 1 Or txt_Tag > 31 Then
If txt_Tag < 1 Or txt_Tag > 31 Then MsgBox "Falsche Einagbe! Bitte geben Sie einen Tag zwischen 1 und 31 ein", vbOKOnly
If txt_Monat < 1 Or txt_Monat > 12 Then MsgBox "Falsche Eingabe! Sie müssen einen Monat zwischen 1 und 12 eingeben", vbOKOnly
Else
If txt_Monat = 1 Then Monatstage = 31
If txt_Monat = 2 Then Monatstage = 29
If txt_Monat = 3 Then Monatstage = 31
If txt_Monat = 4 Then Monatstage = 30
If txt_Monat = 5 Then Monatstage = 31
If txt_Monat = 6 Then Monatstage = 30
If txt_Monat = 7 Then Monatstage = 31
If txt_Monat = 8 Then Monatstage = 31
If txt_Monat = 9 Then Monatstage = 30
If txt_Monat = 10 Then Monatstage = 31
If txt_Monat = 11 Then Monatstage = 30
If txt_Monat = 12 Then Monatstage = 31
If txt_Tag > Monatstage Then
MsgBox "Der Monat hat nur " & Monatstage & " Tage! Geben Sie den Tag neu ein!", vbOKOnly
Else
lbl_Datum = txt_Tag & "." & txt_Monat & "." & txt_Jahr
txt_Tag.Text = Tage
txt_Monat.Text = Monat
If txt_Monat = 1 Then <font color="red"> (Hier muss der fehler irgendwo sein, hab alle möglichkeiten durch genommen, hab kein plan was noch falsch ist ) </font>
Quotient = Tage / 7
Produkt = Tage * Quotient
Rest = Tage - Produkt
lbl_Quotient = Quotient
lbl_Produkt = Produkt
lbl_Rest = "Rest"
End If
If Monat = 2 Then
Tage = Tage + 31
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 3 Then
Tage = Tage + 60
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 4 Then
Tage = Tage + 91
Quotient = Tage / 7
Produkt = Tage * Quotient
Rest = Tage - Produkt
End If
If Monat = 5 Then
Tage = Tage + 121
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 6 Then
Tage = Tage + 152
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 7 Then
Tage = Tage + 182
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 8 Then
Tage = Tage + 213
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 9 Then
Tage = Tage + 244
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 10 Then
Tage = Tage + 274
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 11 Then
Tage = Tage + 305
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 12 Then
Tage = Tage + 355
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Rest = 0 Then lbl_Wochentag = "Donnerstag"
If Rest = 1 Then lbl_Wochentag = "Freitag"
If Rest = 2 Then lbl_Wochentag = "Samstag"
If Rest = 3 Then lbl_Wochentag = "Sonntag"
If Rest = 4 Then lbl_Wochentag = "Montag"
If Rest = 5 Then lbl_Wochentag = "Dienstag"
If Rest = 6 Then lbl_Wochentag = "Mittwoch"
lbl_Quotient.Caption = Quotient
lbl_Produkt.Caption = Produkt
lbl_Rest.Caption = Rest
End If
End If
End Sub
<font color="red"> Edit by Agent: Titel "Fehler in Syntax" ist zu allgemein! -> geändert </font>
Ich wollte mir die Wochentage anzeigen lassen, wenn ich das Datum eingebe. Aber das funzt nicht, könnt ihr mir sagen wo der Fehler liegt? Später will ich daraus meinen Bus anzeigen lassen wenn man Datum und Uhrzeit eingibt. Naja egal(nur zur erläuterung)
Für Hilfe wär ich echt dankbar!
Dim Monatstage As Long, Monat As Long, Tage As Long, Quotient As Long, Produkt As Long, Rest As Long, AnzahlTage As Long
Private Sub cmd_Ende_Click()
End
End Sub
Private Sub cmd_Loeschen_Click()
txt_Tag = ""
txt_Monat = ""
txt_Jahr = ""
lbl_Wochentag = ""
lbl_Datum = ""
lbl_Quotient = ""
lbl_Produkt = ""
lbl_Rest = ""
End Sub
Private Sub cmd_Ok_Click()
If txt_Monat < 1 Or txt_Monat > 12 Or txt_Tag < 1 Or txt_Tag > 31 Then
If txt_Tag < 1 Or txt_Tag > 31 Then MsgBox "Falsche Einagbe! Bitte geben Sie einen Tag zwischen 1 und 31 ein", vbOKOnly
If txt_Monat < 1 Or txt_Monat > 12 Then MsgBox "Falsche Eingabe! Sie müssen einen Monat zwischen 1 und 12 eingeben", vbOKOnly
Else
If txt_Monat = 1 Then Monatstage = 31
If txt_Monat = 2 Then Monatstage = 29
If txt_Monat = 3 Then Monatstage = 31
If txt_Monat = 4 Then Monatstage = 30
If txt_Monat = 5 Then Monatstage = 31
If txt_Monat = 6 Then Monatstage = 30
If txt_Monat = 7 Then Monatstage = 31
If txt_Monat = 8 Then Monatstage = 31
If txt_Monat = 9 Then Monatstage = 30
If txt_Monat = 10 Then Monatstage = 31
If txt_Monat = 11 Then Monatstage = 30
If txt_Monat = 12 Then Monatstage = 31
If txt_Tag > Monatstage Then
MsgBox "Der Monat hat nur " & Monatstage & " Tage! Geben Sie den Tag neu ein!", vbOKOnly
Else
lbl_Datum = txt_Tag & "." & txt_Monat & "." & txt_Jahr
txt_Tag.Text = Tage
txt_Monat.Text = Monat
If txt_Monat = 1 Then <font color="red"> (Hier muss der fehler irgendwo sein, hab alle möglichkeiten durch genommen, hab kein plan was noch falsch ist ) </font>
Quotient = Tage / 7
Produkt = Tage * Quotient
Rest = Tage - Produkt
lbl_Quotient = Quotient
lbl_Produkt = Produkt
lbl_Rest = "Rest"
End If
If Monat = 2 Then
Tage = Tage + 31
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 3 Then
Tage = Tage + 60
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 4 Then
Tage = Tage + 91
Quotient = Tage / 7
Produkt = Tage * Quotient
Rest = Tage - Produkt
End If
If Monat = 5 Then
Tage = Tage + 121
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 6 Then
Tage = Tage + 152
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 7 Then
Tage = Tage + 182
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 8 Then
Tage = Tage + 213
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 9 Then
Tage = Tage + 244
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 10 Then
Tage = Tage + 274
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 11 Then
Tage = Tage + 305
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Monat = 12 Then
Tage = Tage + 355
Quotient = Tage / 7
Produkt = 7 * Quotient
Rest = Tage - Produkt
End If
If Rest = 0 Then lbl_Wochentag = "Donnerstag"
If Rest = 1 Then lbl_Wochentag = "Freitag"
If Rest = 2 Then lbl_Wochentag = "Samstag"
If Rest = 3 Then lbl_Wochentag = "Sonntag"
If Rest = 4 Then lbl_Wochentag = "Montag"
If Rest = 5 Then lbl_Wochentag = "Dienstag"
If Rest = 6 Then lbl_Wochentag = "Mittwoch"
lbl_Quotient.Caption = Quotient
lbl_Produkt.Caption = Produkt
lbl_Rest.Caption = Rest
End If
End If
End Sub
<font color="red"> Edit by Agent: Titel "Fehler in Syntax" ist zu allgemein! -> geändert </font>
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Agent“ ()