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.

Array & Schleife (VB6)

Empfohlene Antworten

Veröffentlicht

Mahlzeit!

Folgenden Ausgangslage:

ich habe eine Funktion die mir ein Array liefert. Dieses soll aber nur durchlaufen werden, wenn es nicht leer ist.

Wie kann ich das prüfen??

'Funktion

Public Function GetArray(index As String) As String()

[INDENT]Dim rs As Recordset

Dim sql As String

Dim array() As String


sql = "select ... "

Set rs = databaseVerschleiss.OpenRecordset(sql)


If Not rs.EOF Then           

[INDENT]ReDim arEinzelteile(rs.RecordCount - 1)

GetArray = array[/INDENT]
End If[/INDENT]

End Function


' Funktionsaufruf

array = GetArray(index)


For Each value In array

[INDENT]...

<tu etwas>

...[/INDENT]


Next

naja einfach die zeilen des arrays zaehlen...

falls diese nicht mind. 1 beträgt --> ende

Hi,

irgendwie erkenne ich den Sinn des Parameters für die Funktion nicht, aber das ist ja erstma Wurscht.

Zudem ist nicht ersichtlich woher "arrEinzelTeile" kommt und was Du mit der Funktion erreichen willst.

Kann sein, dass Du mit UBound weiterkommst:


'Funktion

Public Function GetArray(index As String) As String()


        Dim rs As Recordset 

        Dim sql As String 

        Dim array() As String 


        sql = "select ... " 

        Set rs = databaseVerschleiss.OpenRecordset(sql) 


        If (Not (Rs Is Nothing)) Then

             With Rs

                 If (Not (.EOF)) Then

                     If (.RecordCount <> 0) Then

                           ReDim arEinzelteile(.RecordCount - 1) 

                           GetArray = array

                      End If

                 End If

             End With

        End If

End Function



'---- Funktionsaufruf

array = GetArray(index)


If (UBound(array) >0) Then

     For Each value In array


          .. <tu etwas> ...


     Next

End If

Ansonsten mal hier schauen:

FAQ 0067: Wie ermittle ich die Grenzen eines Feldes?

http://www.activevb.de/rubriken/faq/faq0067.html

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.