Results 1 to 2 of 2

Thread: put #1,1,data -> bad record length

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    chicago (hope)
    Posts
    146

    put #1,1,data -> bad record length

    hi guys...

    ok... i have some settings... i save them to a file with help of a own datatype....
    works well.
    i open it, and read the settings...
    also works well.
    but when i change something (2 strings), and i try to save, it says "bad record length"

    what to do...???


    Code:
    saving:
    
    Private Sub Image3_Click()
    Dim im, th
    
    iGalleRy.image_filename = image_filename(1)
    iGalleRy.index_filename = index_filename(0)
    iGalleRy.image_image_srv = image_image_srv(1)
    iGalleRy.index_image_srv = index_image_srv(0)
    iGalleRy.image_site_title = image_site_title(1)
    iGalleRy.index_site_title = index_site_title(0)
    
    'iGalleRy.images = im
    'iGalleRy.thumbs = th
    CommonDialog1.Flags = cdlOFNExplorer + cdlOFNOverwritePrompt
    CommonDialog1.ShowSave
    
    Open CommonDialog1.FileName For Output As #2
    Print #2, ""
    Close
    
    Open CommonDialog1.FileName For Random As #1
    Put #1, 1, iGalleRy
    Close
    
    End Sub
    
    ----------------------------------------------
    
    opening:
    
    Private Sub Image1_Click()
    CommonDialog1.Flags = cdlOFNExplorer + cdlOFNHideReadOnly
    CommonDialog1.ShowOpen
    
    Open CommonDialog1.FileName For Random As #1
    Get #1, 1, iGalleRy
    Close
    
    image_filename(1) = iGalleRy.image_filename
    index_filename(0) = iGalleRy.index_filename
    image_image_srv(1) = iGalleRy.image_image_srv
    index_image_srv(0) = iGalleRy.index_image_srv
    image_site_title(1) = iGalleRy.image_site_title
    index_site_title(0) = iGalleRy.index_site_title
    
    im = Split(iGalleRy.images, vbNullChar)
    
    For x = 0 To UBound(im)
        For y = 0 To images.List1.ListCount - 1
            If images.List1.List(y) = im(x) Then GoTo weiter
        Next y
    
        images.List1.AddItem im(x)
    weiter:
    Next x
    
    th = Split(iGalleRy.thumbs, vbNullChar)
    
    For x = 0 To UBound(th)
        For y = 0 To thumbs.List1.ListCount - 1
            If thumbs.List1.List(y) = th(x) Then GoTo weiter2
        Next y
    
        thumbs.List1.AddItem th(x)
    weiter2:
    Next x
    
    
    End Sub
    
    ---------------
    
    datatype:
    
    Type gallery
        images As String
        thumbs As String
        index_filename As String
        image_filename As String
        index_site_title As String
        image_site_title As String
        index_image_srv As String
        image_image_srv As String
    End Type
    
    Global iGalleRy As gallery
    cheerz

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Instead of opening AS RANDOM open AS BINARY

    This will fix it.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

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