Results 1 to 3 of 3

Thread: type mismatch, Array is problem or control?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2010
    Posts
    61

    type mismatch, Array is problem or control?

    This probably shouldn't be on the main form, maybe better in a module, but here it is anyway.

    The Array FineArr() is defined as public in a module, as are the other variables used here...
    AGet, Tmp3, As String
    A_Get As Double
    and SBValue and K as Long

    OverWriteGFile (Tmp3) is commented out, as it's calling a sub in a module that I don't expect to work yet.

    I get "Compile Error, Type Mismatch', with "Private Sub Command5_Click()" in the yellow block, and FineArr as below in a Blue block.

    Private Sub Command5_Click()

    AGet = A_Get
    Tmp3 = ReadFile(File2.Path & "/" & File2.List(File2.ListIndex))
    FineArr2 = Split(Tmp3, vbNewLine)

    For K = LBound(FineArr2) To UBound(FineArr2)
    If InStr(FineArr2, AGet) Then FineArr(K) = FineArr(K) & " Z" & SBValue
    Next K

    Join(FineArr2, vbNewLine) = Tmp3
    Form1.RichTextBox1 = Tmp3
    'OverWriteGFile (Tmp3)
    Form1.RichTextBox1 = Tmp2

    End Sub


    I though that because "FineArr" is defined as String, it would be okay to search inside it for "AGet", but maybe that's not the problem? I could understand if I was searching a string for a substring that was actually a double, as in "A_Get". What is the problem/problems here?

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: type mismatch, Array is problem or control?

    In the InStr function you need to have an index associated with FinArr2

    I'm assuming you need something like this instead

    If InStr(FineArr2(K), AGet) Then FineArr(K) = FineArr(K) & " Z" & SBValue

  3. #3
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,733

    Re: type mismatch, Array is problem or control?

    The Join seems to be in wrong order.
    Tmp3 = Join(FineArr, vbNewLine)

Tags for this Thread

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