|
-
Aug 10th, 2000, 04:35 AM
#1
Thread Starter
Member
I have a major headache doing what ought to be simple. My problem is this. I have a small App which needs to read in a raw ascii file, display it on screen within a VB control (textbox was too small) richtext seems to be fine. I need control over the file in VB so I can allow the user to edit it without hitting carraige returns and forcing insert mode etc.... thus I don't think opening it in another text editor will be any use, hence I am trying to write my own. It works fine except for one major flaw, the richtextbox appears to be dropping some formatting, the lines come out spaced all over the place eg:
It should resemble:
Run1 | Value1 | Value2
Run2 | Value1 | Value2
But in fact it comes out with Value 1 on Run 2 moved over the the left about the length of a tab and the same for all lines.
I open the file using the loadfile method, I have also tried to read it in line by line and paste to the clipboard then paste back into the control, I have tried reading it line by line directly(and slowly) into the RTB.
What is really strange is that I can read the file in sequentialy and write it to another file using the open and line input/print functions and it comes out fine, I can also open the file in any existing text editor and it comes out fine, I can for example cut and paste it to notepad and it works, but even when I cut and paste it to a RTB is still comes out funny and I can't allow that. I would appreciate it if anyone could tell me about a way around this, or even an alternative. Someone out there must have written a text editor that was capable of 100k+ files before.
Thanks.
DQ
[Edited by davidq on 08-10-2000 at 05:39 AM]
-
Aug 10th, 2000, 04:46 AM
#2
In all of the editors that I've maid I haven't had any problems reading ASCII files using the Input function:
Code:
'assumes that the file name is stored in the sFileName string
'and that iFileHandle is declared as an Integer
iFileHandle = FreeFile
Open sFileName For Input As #iFileHandle
RichTextBox1.Text = Input(LOF(iFileHandle), iFileHandle)
Close #iFileHandle
Good luck!
-
Aug 10th, 2000, 05:10 AM
#3
Thread Starter
Member
Thanks for the reply, I've already tried that and it gives the same result. Perhaps the system which is producing the file (a unix box) is putting in strange control chars, however VB will still read it back to another text file perfectly just not to the richtext box, If you wanted I could mail you the text file (84kb) so you could see what I mean.
-
Aug 10th, 2000, 05:16 AM
#4
Yes, please do e-mail me the file.
-
Aug 16th, 2000, 02:48 PM
#5
Lively Member
Have you tried using LINE INPUT when reading the file and the .TEXTRTF when take text fromt he RTB so it's not formated?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|