ListBox with switched rows and columns

Hi, guys,

I need to create a table with patient’s lab work results collected over seven days.

Lab values are usually presented vertically while dates are located on the horizontal axis.

To use ListBox for this purpose, I need to have ListBox turned 90 degree. Is this even possible?

Thank you,

VK

You can draw the text yourself (eg rotated) in the CellTextPaint event.

HI, Markus,

Thank you for the reply. The problem is not how the text is written within a cell but in what direction the list grows.

Normally, lists are growing in size vertically. I need them to grow horizontally.

A graph image below shows that the dates are plotted horizontally (resemble a timeline).

The ListBox has a limited number of colums, so you would need to use an underlying data structure and display a view onto those data with a limited number of columns (show only the ones in the visible range, eg 1-11, 2-12, 3-13 etc). I would use a Canvas as that gives you much more control on what to draw how / where / when.

Yes, you can add columns to a listbox by setting the ColumnCount property. But as has been mentioned, there is a limit to the number of columns that can be displayed.

Thank you to everyone who replied.

It seems to me that the best solution is to use a Canvas instead of a ListBox.

My project is a simulated electronic healthcare system (S-EHR) teaching tool for students. No data is collected in real time. For this project, using Canvas is very appropriate.

If it were a real EHR when data is collected almost indefinitely, I would need to put parameters into the column headers and populate data in row (because the maximum number of rows is unlimited or almost unlimited).

Thank you again,

VK

[quote=407356:@VALERIY KOZMENKO]My project is a simulated electronic healthcare system (S-EHR) teaching tool for students. No data is collected in real time. For this project, using Canvas is very appropriate.

If it were a real EHR when data is collected almost indefinitely, I would need to put parameters into the column headers and populate data in row (because the maximum number of rows is unlimited or almost unlimited).[/quote]

You are thinking like a user, not object-oriented like a programmer. If it is real data then you collect it into your data structure and store it, most likely into a database). Then you have a view into your data (the canvas) that you update from your data structure or database.

For example have a class DataPoint with properties xDate as date, yConc as double, colour as color, saved as boolean etc and methods like Save, Delete, Load etc that will save / delete / load it immediately into / from / from the database

Have a data structure like maybe an array of DataPoints: DataStructure() as DataPoint

AS you read a new data point you create one in your app: dim dp as new DataPoint, set its values, and call its save method with dp.save (keep in mind that the array should not hold millions of data points or your app will slow down and you will run out of memory)

In your view (the canvas) you use a timer to display the data points that cover the viewable range, which is the newest datapoint (easily found as it is the latest one added to the array, so use ubound; or get it from the database) and the 10 before it.

Etc etc