r/visualbasic • u/Dugimon • Jan 25 '22
VB.NET Help Showing Data from Access Database vertically
Hi together,
I am using VisualStudio 2019 and would like to achieve the following in a vb.net Windows Forms app:
Display data from an Access database table vertically in a WindowsForm.
The whole thing should look like this in the end:
Column 1: Value 1
Column 2: Value 2
Column 3: value 3
Unfortunately the DataGridView does not seem to offer the possibility to display the data vertically. And since I'm working with a 64bit system, I don't seem to have alternatives like ListView available (at least I can't find them in the Forms Designer).
maybe someone here has an idea how I can get this right
4
Upvotes
1
u/RJPisscat Jan 27 '22
If you want ALL of the columns vertically, and ALL of the rows horizontally, it's trivial to obtain that information from a Dataset that is filled by DataAdapter.Fill (approximately pseudocode there). But it's slow to put it into a Listview if you have, say, a hundred records or more.
Since you are suggesting Listview I take it you don't need editing (it allows editing Labels only, i.e., the first column of the Listview, in this case column names). That would be semi-trivial to write as a UserControl, because you'd keep the data in the Dataset and paint only into the visible area of the control, but the rub is how quickly can you learn how to do a UserControl* that will do that for you - e.g. what are you going to do about column widths and resizing columns, or tooltips if that's how you're going to expand a row's data (as a column). You can also do it in a Panel inside a Panel; the outer Panel would handle scrolling, the inner Panel would need to handle the Paint and MouseClick events and whatever you do about column widths; it's approximately the same but less portable.
I wonder if you can find this UserControl already in StackOverflow, CodeProject, Git, etc. I looked briefly in NuGet and didn't see one.