Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[VB.NET] datum for-schleife

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

ich brauche Hilfe: bin Neuling in VB...

Nun brauche ich in VB eine Schleife die mir jedes Datum ausgibt für ein Jahr! Habe bisher nur in C++ /consolenanwendung programmiert....

Habe keinen Ansatzpunkt. Und vielleicht noch einen Tip wie ich das in eine Windows form bekomme!

Wie kann ich das anstellen?

Vielen Dank schon mal!!!

ungetestet:

Sub GibMirAlleTageDesJahresAus()


Dim A As Date

Dim B As Date

Dim T As Date


A = "01.01.2006"

B = "01.01.2007"


For T = A To B

    Debug.Print T

Next T


End Sub

um das ergebnis der auflistung im formular darzustellen, verwende anstatt von Debug.Print ein textfeld/kombifeld/listenfeld - oder was auch immer du verwendest - und stell dort den inhalt rein.

s'Amstel

ich habs versucht,er sagt mir bei der For-schleife, das date keine schleifensteuerungsvariable ist und bei print : kein Member von...

und wenn ich show(T) benutze, sagt er mir zu viele Argumente...

muss ich noch irgendwas oben in der klasse deklarieren...Import oder inherits?

danke für Ihre(deine) Hilfe schon mal!!!:)

muss ich noch irgendwas oben in der klasse deklarieren...Import oder inherits?

ich entnehme deiner aussage, dass du in VB.net codest. vielleicht hättest dann auch im entsprechenden forum (http://forum.fachinformatiker.de/net/) posten sollen, da ich annahm, mit VB sei VB 6 gemeint.

s'Amstel

VB.NET


Sub AlleTagevonJahr(ByVal Jahr as Integer)

  Dim Datum as Date = New Date(Jahr, 1, 1)


  Do While Year(Datum) = Jahr

    Debug.Print(Datum.ToShortDateString)

    Datum = Datum.AddDays(1)

  Loop

End Sub

VB 6

Sub AlleTagevonJahr(ByVal Jahr as Integer)

  Dim Datum as Date

  Datum = "1.1." & Jahr


  Do While Year(Datum) = Jahr

    Debug.Print(Datum)

    Datum = Datum + 1

  Loop

End Sub

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.