limit size data type

Discussion in 'AutoCAD' started by elefebvre, May 28, 2004.

  1. elefebvre

    elefebvre Guest

    is there a limit to a data type that i create myself?

    Type BARdata
    DIA As Byte
    RADIUS(0 To 7) As Integer
    End Type

    gives error "bad record length"

    Type BARdata
    DIA As Byte
    RADIUS(0 To 7) As byte
    End Type

    gives no error

    ???
     
    elefebvre, May 28, 2004
    #1
  2. elefebvre

    Joe Sutphin Guest

    Try this, it works fine for me.

    Joe
    --
    Option Explicit

    Private Type BARdata
    DIA As Byte
    RADIUS(0 To 7) As Integer
    End Type

    Public Sub Test()
    Dim X As BARdata
    Dim Index As Long

    For Index = 0 To 7
    X.RADIUS(Index) = Index + 1
    Debug.Print X.RADIUS(Index)
    Next Index
    End Sub
     
    Joe Sutphin, May 28, 2004
    #2
  3. elefebvre

    elefebvre Guest

    Joe,

    thanks for your reply. Here below, i put the entire code which gives a better idea of the situation. The program still gives an error on the line with "Put..."

    Option explicit

    Type BARdata
    DIA As Byte
    RADIUS(0 To 7) As Integer
    End Type


    Public Sub save_bar_radius()

    Dim BAR As BARdata
    Dim i, j As Integer
    Dim STRlist(0 To 7) As String
    Dim DIAlist(0 To 9) As Integer


    STRlist(0) = "en_T_"
    STRlist(1) = "en_S_"
    STRlist(2) = "be_T_"
    STRlist(3) = "be_S_"
    STRlist(4) = "nl_T_"
    STRlist(5) = "nl_S_"
    STRlist(6) = "fr_T_"
    STRlist(7) = "fr_S_"

    DIAlist(0) = 6
    DIAlist(1) = 8
    DIAlist(2) = 10
    DIAlist(3) = 12
    DIAlist(4) = 14
    DIAlist(5) = 16
    DIAlist(6) = 20
    DIAlist(7) = 25
    DIAlist(8) = 32
    DIAlist(9) = 40


    Open "C:\Program Files\B6_BBS\Data\Bar_radius.dat" For Random As 1 Len = 10


    For i = 0 To 9
    BAR.DIA = DIAlist(i)
    For j = 1 To 7
    BAR.RADIUS(j) = Val(frmSETTINGS(STRlist(j) & DIAlist(i)))
    Next j
    Put 1, i + 1, BAR
    Next i


    Close 1

    End Sub
     
    elefebvre, May 28, 2004
    #3
  4. elefebvre

    elefebvre Guest

    Joe,

    i am starting to guess that actually the problem lays with the file. Is a file limited in receiving a certain size of record?
     
    elefebvre, May 28, 2004
    #4
  5. elefebvre

    Joe Sutphin Guest

    You need to change the length value of your record in the Open statement.
    Put this line

    Debug.Print Len(BAR)

    after the BAR.RADIUS(j) line to see the actual record size.

    Joe
    --

    file limited in receiving a certain size of record?
     
    Joe Sutphin, May 28, 2004
    #5
  6. elefebvre

    elefebvre Guest

    that works. thanks a bunch!!!
     
    elefebvre, May 28, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.