NAIVER ANSATZ VON HERRN LEHMANN ...

Private mText As String[]


Public Sub Form_Open()
  Dim sElement As String
  Dim sText As String
  Dim iCount As Integer
  
  FMain.Center
  FMain.Resizable = False
  DirChooser1.Icon = Picture["icon:/16/halt"]
  
  sText = File.Load("Notes/a.txt")
  Print sText
  
  mText = New String[]
  mText = Split(File.Load("Notes/a.txt"), "#")
  
  For Each sElement In mText
    'sElement = Replace(mText[iCount], gb.NewLine, "")
    'sElement = Replace(sElement, gb.NewLine, "")
    ' Inc iCount
    Print sElement
    TextArea1.Insert(sElement)
  Next


Print SpinBox1.Text
End ' Form_Open()


################################################################


--- Ansatz 1: File.Load() und Split()

Dim sFile As String
Dim aParagraphs As New String[]

' Dateiinhalt lesen
  sFile = File.Load("/pfad/datei")
' Leerzeile bedeutet zwei Zeilenumbrueche hintereinander: "\n\n"
  aParagraphs = Split(sFile, "\n\n")
' aParagraphs enthaelt die Absaetze

---


--- Ansatz 2: Line Input

Dim hFile As File
Dim sLine As String
Dim aParagraphs As New String[]
Dim iIndex As Integer

hFile = Open "/pfad/datei" For Read
iIndex = 0
While Not Eof(hFile)
	Line Input #hFile, sLine
	' Leerzeile?
	If sLine <> "" Then
		' Neues Element noetig?
		If aParagraphs.Count = iIndex Then
			aParagraph.Add("")
		Endif
		' An den Paragraphen anhaengen
		aParagraphs[iIndex] &= sLine & "\n"
	Else
		' Neuer Paragraph
		Inc iIndex
	Endif
Wend
Close #hFile
' aParagraphs enthaelt die Absaetze

--- Ansatz 3: Kein String[], sonst Ansatz 2

' aButtons ist ein Array der 15 Buttons
Dim hFile As File
Dim sLine As String
Dim iIndex As Integer

hFile = Open "/pfad/datei" For Read
iIndex = 0
While Not Eof(hFile)
	Line Input #hFile, sLine
	If sLine <> "" Then
		aButtons[iIndex].Tag &= sLine & "\n"
	Else
		Inc iIndex
	Endif
Wend
Close #hFile

' Jeder Button hat seinen Paragraphen in seiner Tag-Eigenschaft

Der Vorteil von Ansatz 3 ist, dass man die Buttons dann in eine Gruppe
(z.B. .Group = "ParagraphButtons") legen kann und dann im gemeinsamen:

Public Sub ParagraphButtons_Click()
  Message.Info(Last.Tag)
End

Fuer solche Aufgaben gibt es die Tag-Eigenschaft - meint Tobias. 
Recht hat er ...

