Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arrays inside Types?
#23
This thread seems to me have gone off the rails. The original question was whether arrays are possible within records. They aren't! But maybe there's a way to circumvent this limitation by "simulating" it.
I tried this, and it should come pretty close to arrays within records for certain programming tasks. I couldn't think of a better example.

Some data is requested, and then the answer is displayed, along with an image. Nice!  Big Grin

Code: (Select All)

'Verschachtelte Recordarrays - 7./10. Maerz 2026

Screen _NewImage(550, 390, 32)
$Color:32

Option _Explicit

Type Automodelle
  Modell As String
  Hubraum As String
  Leistung As String
End Type

Type Datenblatt
  Modelldaten As Automodelle
  Farbe As String
  FarbeBrilliant As String
  Verbrauch As String
  Tankgroesse As String
  Preis As String
End Type

Type Spezielles
  Extra As Datenblatt
  Sonderausstattung As String
End Type

Dim Modell(5) As Datenblatt
Dim Special(2) As Spezielles

Dim As String ps
Dim As Long Bild

Locate 2, 3
Input "Modell                : ", Modell(1).Modelldaten.Modell
Locate 3, 3
Input "Hubraum in ccm        : ", Modell(1).Modelldaten.Hubraum
Locate 4, 3
Input "Motorleistung Kw      : ", Modell(1).Modelldaten.Leistung
Locate 5, 3
Input "Farbauswahl            : ", Modell(1).Farbe
Locate 6, 3
Input "Farbe brilliant Ja/Nein: ", Special(1).Extra.FarbeBrilliant
Sleep 2

Cls
Locate 2, 3
Print "Ihre Auswahl war:"
Locate 4, 3
Print "Modell      : "; Modell(1).Modelldaten.Modell
Locate 5, 3
Print "Hubraum      : "; Modell(1).Modelldaten.Hubraum; " ccm"

Locate 6, 3
'KW auch als PS ausgeben
ps = Str$(Val(Modell(1).Modelldaten.Leistung) * 1.36)
Print "Motorleistung: "; Modell(1).Modelldaten.Leistung; " Kw"; " ("; ps; " PS )"

Locate 7, 3
Print "Farbauswahl  : "; Modell(1).Farbe

Locate 9, 3
If Special(1).Extra.FarbeBrilliant = "Ja" Then
  Modell(1).Preis = "52.899.00"
  Print "Preis Ihrer Modellauswahl: "; Modell(1).Preis
Else
  Modell(1).Preis = "49.500.00"
  Print "Preis Ihrer Modellauswahl: "; Modell(1).Preis
End If

Bild = _LoadImage("..\..\..\Bilder\AudiS3-Kl.jpg") 'Siehe Hinweis unten um das Bild zu erhalten
_PutImage (20, 185), Bild 'Platzierung des Bildes. Haengt von der Fenstergroesse ab

End

Image of the answer: "No" was entered.
[Image: Audi-Sportback-Record-Array.jpg]
Reply


Messages In This Thread
Arrays inside Types? - by Ikerkaz - 03-04-2026, 09:44 PM
RE: Arrays inside Types? - by justsomeguy - 03-04-2026, 09:57 PM
RE: Arrays inside Types? - by Jack - 03-04-2026, 10:39 PM
RE: Arrays inside Types? - by bplus - 03-04-2026, 11:45 PM
RE: Arrays inside Types? - by hsiangch_ong - 03-05-2026, 01:32 AM
RE: Arrays inside Types? - by ahenry3068 - 03-05-2026, 04:21 PM
RE: Arrays inside Types? - by Jack - 03-05-2026, 02:14 PM
RE: Arrays inside Types? - by Kernelpanic - 03-05-2026, 03:27 PM
RE: Arrays inside Types? - by Kernelpanic - 03-06-2026, 02:48 PM
RE: Arrays inside Types? - by hsiangch_ong - 03-06-2026, 05:43 PM
RE: Arrays inside Types? - by CookieOscar - 03-06-2026, 06:23 PM
RE: Arrays inside Types? - by bplus - 03-07-2026, 08:29 AM
RE: Arrays inside Types? - by Kernelpanic - 03-06-2026, 09:54 PM
RE: Arrays inside Types? - by Unseen Machine - 03-07-2026, 11:04 AM
RE: Arrays inside Types? - by Jack - 03-07-2026, 12:33 PM
RE: Arrays inside Types? - by bplus - 03-07-2026, 12:42 PM
RE: Arrays inside Types? - by bplus - 03-07-2026, 12:55 PM
RE: Arrays inside Types? - by Jack - 03-07-2026, 03:24 PM
RE: Arrays inside Types? - by SMcNeill - 03-07-2026, 03:46 PM
RE: Arrays inside Types? - by Jack - 03-07-2026, 03:59 PM
RE: Arrays inside Types? - by Jack - 03-07-2026, 04:23 PM
RE: Arrays inside Types? - by bplus - 03-08-2026, 07:20 PM
RE: Arrays inside Types? - by Kernelpanic - Yesterday, 06:01 PM
RE: Arrays inside Types? - by Petr - Yesterday, 08:02 PM
RE: Arrays inside Types? - by Jack - Yesterday, 08:14 PM
RE: Arrays inside Types? - by Petr - Yesterday, 08:19 PM
RE: Arrays inside Types? - by Jack - Yesterday, 08:23 PM
RE: Arrays inside Types? - by Jack - Yesterday, 08:45 PM
RE: Arrays inside Types? - by bplus - 8 hours ago
RE: Arrays inside Types? - by Petr - Yesterday, 08:52 PM
RE: Arrays inside Types? - by Jack - 8 hours ago
RE: Arrays inside Types? - by Jack - 5 hours ago

Possibly Related Threads…
Thread Author Replies Views Last Post
  Arrays as UDTs Pete 26 1,245 02-06-2026, 04:31 AM
Last Post: bplus
  Preserving multi-dim arrays Pete 5 433 12-19-2025, 03:17 PM
Last Post: Dimster
  Array out of passing arrays... Pete 2 417 09-22-2025, 08:53 PM
Last Post: ahenry3068
  Methods in types bobalooie 7 1,596 01-30-2025, 08:00 PM
Last Post: Pete
  C++ types > QB64 types: do we have an equivalent QB64PE page? madscijr 5 1,152 06-01-2024, 03:44 AM
Last Post: grymmjack

Forum Jump:


Users browsing this thread: 1 Guest(s)