@Kenneth R This seems weird to me. I'm opening a variety of file types: ODBC, CSV, TAB, SQLite, Excel, even Access. Users are supposed to provide a data file for analysis in a particular format: Header row, followed by n data rows. These are essentially database tables, and they get loaded into a SQLite database. My analytics operate on those SQLite tables.
I need to provide a quick eval to the user to ensure that the file user has picked looks like it should. So I'm popping 100 rows into a listbox without formatting, just raw. This is mainly for the delimited text files, I use a different approach for database and Excel files (MBS for that). This works and is easy. The listbox specs include horizontal and vertical scrollbars.
But only the vertical scrollbar shows up. The data look fine but I can't see the right side of the data. The horizontal scrollbar doesn't show up. I've tried several things, including adding an individual scrollbar, to no avail. Granted the listbox has only one column (a big one) but I still want to scroll to the right.
Do I have to have more than one column or something? What gives?
- Add an horizontal scrollbar control to the listbox
- Make sure the listbox ScrollbarHorizontal is off
- Add this to the scrollbar :
Sub ValueChanged() Listbox1.ScrollPositionX = me.value End Sub
Now the tricky part : to avoid the lines to be cut with a ... at then end, you need to set the width of the column to the maximum length in points of the text you load. And to set the maximum value of the scrollbar to the same amount.
Use Graphics.Stringwidth to find the width in points of the longest string loaded in the ListBox.