Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UDT problems
#25
Code: (Select All)
CONST NITEMS = 20, ARLEN = 8
Type Datatype
  'Array1 field
  Var As Integer
  'Array2 field
  Var2 As Integer
  'Array3 field
  Var3 As Integer
End Type
Dim DataRecord(1 to NITEMS) As Datatype
Dim As Integer Array1(1 to NITEMS, 1 to ARLEN), Array2(1 to NITEMS, 1 to ARLEN), Array3(1 to NITEMS, 1 to ARLEN)
' store first array "field".
FOR N = 1 TO NITEMS
For L = 1 To ARLEN
  Array1(N, L) = L
Next
NEXT

The "Array1" was the "Array" field in the previous example, which was defined as "STRING * 16". The "Array2" and "Array3" were also supposed to be UDT fields. But they are actually arrays independent of the UDT variable. In QB45 and QB64 it has to be done this way whether you like it or not. Otherwise in QB64 you have ```_MEM``` and its association of statements and functions where you don't have to put a static limit on data storage, but is more difficult sometimes to be counting off things by bytes working in this way. Also needing to ask permission from the operating system to allocate a block of memory, and then in the middle of program run, needing to release that memory for other purposes.

It's sloppy but it works.
Reply


Messages In This Thread
UDT problems - by eoredson - 11-12-2023, 05:46 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 05:49 AM
RE: UDT problems - by eoredson - 11-12-2023, 06:05 AM
RE: UDT problems - by mnrvovrfc - 11-12-2023, 06:33 AM
RE: UDT problems - by SpriggsySpriggs - 11-12-2023, 06:19 AM
RE: UDT problems - by eoredson - 11-12-2023, 06:42 AM
RE: UDT problems - by SMcNeill - 11-12-2023, 06:58 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 06:44 AM
RE: UDT problems - by eoredson - 11-12-2023, 06:50 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 06:57 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 06:54 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:02 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:09 AM
RE: UDT problems - by SMcNeill - 11-12-2023, 07:20 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:22 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 07:25 AM
RE: UDT problems - by SpriggsySpriggs - 11-12-2023, 07:27 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:48 AM
RE: UDT problems - by justsomeguy - 11-12-2023, 11:06 AM
RE: UDT problems - by eoredson - 11-12-2023, 11:41 PM
RE: UDT problems - by eoredson - 11-13-2023, 12:38 AM
RE: UDT problems - by SMcNeill - 11-13-2023, 12:52 AM
RE: UDT problems - by justsomeguy - 11-13-2023, 12:58 AM
RE: UDT problems - by eoredson - 11-13-2023, 01:34 AM
RE: UDT problems - by SMcNeill - 11-13-2023, 02:34 AM
RE: UDT problems - by mnrvovrfc - 11-13-2023, 01:48 AM
RE: UDT problems - by eoredson - 11-13-2023, 01:59 AM
RE: UDT problems - by justsomeguy - 11-13-2023, 02:18 AM
RE: UDT problems - by eoredson - 11-13-2023, 02:26 AM
RE: UDT problems - by eoredson - 11-13-2023, 02:52 AM
RE: UDT problems - by justsomeguy - 11-13-2023, 04:57 AM
RE: UDT problems - by eoredson - 11-13-2023, 05:20 AM



Users browsing this thread: 9 Guest(s)