Using QRichEdit in UDTs Posted by: Steve S (IP Logged) Date: June 22, 2004 10:38PM Steve a QRichEdit can be used to store loads of stuff, I always use an invisible one for file handling. What you can do is combine the text strings your program will use into textfiles, then read those into a QRichEdit and in-program process that file.
Here is a code sample; it is the way I prefer to pass data to my program because the .txt files can be easily imported into Excel.
DIM RiEd AS QRICHEDIT
RiEd.plaintext = 1
RiEd.visible = 0
RiEd.PARENT = Form
f$ = "ProASTM.txt"
RiEd.Clear
RiEd.LoadFromFile(f$)
a$ = RiEd.Text
Apro = VAL(MID$(a$,9,8))
DIM Pro$(Apro)
DIM Dast(Apro)
DIM Iast(Apro)
DIM Sast(Apro)
FOR x=1 TO Apro
beg = x * 33 - 15
Pro$(x) = MID$(a$,beg,8)
Dast(x) = VAL(MID$(a$,beg+8,8))
Iast(x) = VAL(MID$(a$,beg+16,8))
Sast(x) = VAL(MID$(a$,beg+24,8))
NEXT x
Of course you might want to build an editor to actually write the texts and whatnot; so you'll need to store stuff from there. The code below is the companion code to the above code for storing data;
a$ = "Baardaap" + LEFT$(STR$(Apro)+" ",8)
FOR x=1 TO Apro
a$=a$ + "*"+LEFT$(Pro$(x)+" ",8)
a$=a$ + LEFT$(STR$(nDast(x))+" ",8)
a$=a$ + LEFT$(STR$(nIast(x))+" ",8)
a$=a$ + LEFT$(STR$(nSast(x))+" ",8)
NEXT x
f$ = "ProASTM.txt"
RiEd.Clear
RiEd.Text = a$
RiEd.SaveToFile(f$)
As you can see I just pass a small amount of data around, but QRichEdit can be multi line. Anyway, hope this is enough to get you started :) |