Results 1 to 2 of 2

Thread: Why doesn't work this code???

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Germany
    Posts
    15
    I have a problem with join Arrays.


    Thanks for help.


    Option Compare Text

    Private Sub Form_Load()
    Dim RegCatValue As String, FileCatValue As String, ldFile As String
    Dim FF As Integer: FF = FreeFile
    Dim tmp1Array() As String
    Dim tmp2Array() As String
    Dim tmpAll() As String


    Dim I As Integer


    'On Error GoTo ErrorHandler

    ldFile = App.Path & "\NewCategories"


    'Schlüssel aus der Registry lesen
    RegCatValue = GetString(HKEY_CURRENT_USER, "Software\Microsoft\Office\9.0\Outlook\Categories", "MasterList")


    'Schlüssel aus der Datei "NewCategories" lesen
    Open ldFile For Input As #FF
    Do While Not EOF(1)
    Line Input #FF, FileCatValue
    Label2.Caption = FileCatValue
    Loop
    Close #FF


    'Schlüssel anzeigen
    Label1.Caption = "Werte aus Registrierung: " & RegCatValue
    Label2.Caption = "Werte aus Datei: " & FileCatValue


    'Schlüssel vergleichen
    If (RegCatValue = FileCatValue) Then
    'do something
    MsgBox ("Gleich")
    Else

    Label2.ForeColor = RGB(255, 0, 0)

    tmp1Array() = Split(RegCatValue, ";", , vbTextCompare)
    tmp2Array() = Split(FileCatValue, ";", , vbTextCompare)

    For I = 0 To UBound(tmp1Array)
    If Right(tmp1Array(I), 1) = "" Then '//check for unwanted symbols like ,. etc
    MsgBox ("Nichts gefunden")
    Else
    If Left(tmp1Array(I), 1) = "-" Then

    'tmp2Array = Join((tmp1Array(I)), "-")
    Else
    End If
    End If
    Next I
    End If

    tmp2All = Join(tmp1Array(tmp2Array(RegCatValue, FileCatValue)))

    Label3.Caption = "Alle Kategorie: " & "" & tmp2All



    Exit Sub

    ErrorHandler:
    MsgBox ("Pfadangaben für die Empfängerdatei überprüfen !"), vbExclamation
    End Sub




  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command1_Click()
        
       'looks like you are trying to join multiple arrays
       'tmp2All = Join(tmp1Array(tmp2Array(RegCatValue, FileCatValue)))
       
        'the join function joins the elements of an array into a string
        'and implements a delimiter if required.
        
        Dim myArr(5)
        Dim i
        Dim myString As String
        
        For i = 0 To 5
         myArr(i) = i
         Next
        
        myString = Join(myArr, ":")
        MsgBox myString    'produces the string  0:1:2:3:4:
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width