Re: List Box? or Text Box?
This is from VB help
A ListBox control displays a list of items from which the user can select one or more. If the number of items exceeds the number that can be displayed, a scroll bar is automatically added to the ListBox control.
I have something like yours and it auto scrolls vertically
Re: List Box? or Text Box?
Thanks for the reply.
But I just discovered something interesting.
Apparently. Using a text box in place of a list box WILL read a text based file.
The reason I didn't see the file contents displayed is because there is a file size limit that a text box can handle.
If a file is text based. It does not matter what the extension is. The common dialog command will handle it. But even if I increase the MAX file size I can only read limited sized text files in the text box.
Anyone know how I can display a large text file (600k) in the text box?
Thanks.
P.S. -This kind of information should be discussed in the newbies section of this site. This is not fun having to find this stuff on my own. And this is very important and needed info for us beginners.
Once I learn all the info needed. I plan on posting a detailed tutorial for newbies to be able to easily display and edit any type of text based files.
Re: List Box? or Text Box?
Try using the RichTextBox control. As far as I can tell, it should handle files the size you mention. You'll need to add the Microsoft Rich Textbox Control 6.0 (SP3) to your project. You'll also want to tell it to use .txt files instead of .rtf files and to add scroll bars. Use the control properties to do this.
Re: List Box? or Text Box?
Thank you for the Info.
I was wondering if Rich text would do it. And you just confirmed it for me.
One more problem solved in a list of many.
Man it sucks to be a newbie ;-).
Thanks.
Re: List Box? or Text Box?
ACK!
Using Rich text works as far as opening and reading the files now. But it changes the layout(format)of the files and if I save it like that. They won't work in the program they are designed to run in.
Is there a way to read a non-rich text file using the rich text box option. without VB actually converting the file to rich text?
I don't see any options in the prefrences for that.
Sorry to be such a pain.
Thanks.
Re: List Box? or Text Box?
Hmm, what kind of formatting are you referring to? A text file, by definition, has no formatting, with the exception of tabs and spaces. The Rich Textbox Control seems to preserve those, at least it did in the test I just ran.
Re: List Box? or Text Box?
Well. Believe it or not. You just helped me again. ;-)
After you said that. I looked for anything out of the ordinary with the files. And sure enough. The problem is that these files contain the symbols { and } to enclose statements.
These text files are 3d graphics files. With an .obj file extesion.
The files are listed in a column which is good and the way I want them. But when I open them with the Rich Text option in VB. Those symbols cause the format to spread out horizontally.
Of course when I save them they are then not formated in a single column like they were before VB opened them.
Is there any way to deal with those pesky {} symbols on opening them without deleting them to maintain my formatting? Maybe I should use the list box option after all?
Thanks for the help.
You've helped me learn some interesting things today.
Re: List Box? or Text Box?
I just ran an experiment and as I suspected those {}'s in your files are placeholders for formatting commands. Or at least they are more than just the {} characters. Stripping them out would be no real challenge, but of course that would destroy your formatting. Do you have access to the file format for these files? Or will the manufacturer of the program used to create them tell you the function of these characters? If so, it might be possible to compensate for them. Still, it will entail a fair amount of work and might be more trouble than it's worth. If the listbox solution will work for you, I'd try that first. Sorry I couldn't be more help.
Re: List Box? or Text Box?
That's OK. I did learn some new things by messing around with this project.
Those {}'s must remain in the text where they are. And the List Box option is very unflexable for me at this time. So I guess I'm outta luck.
I know it's possible to do this because I've got programs that do it. Made by other users. I just don't have the code to see how they did it.
Thanks for the help.