VB.Net - select whole line in a multicolumn ListView and not only first item - vb.net

I have a ListView in VB.Net.
I want to use it to display a table of data.
However I want to be able to click on a row and select it.
The component allows me to select a row only by clicking on the first item of each row.
Can I change that?
Is there a better component to display tables? (I've already tried the DataGridView. I don't like it's appearance)

This should simply be a matter of setting FullRowSelect on the control to be True.

Change the FullRowSelect property to True.

Related

Is there an Python-PyQt5 function for multiselecting from a list using QCombobox?

I am trying to build a GUI with a dropdown for multi-select in python, PyQT5 but, the display is only showing single item instead of a dropdown. Is there a way to include the options as a drop down ?
QlistWidget has the setSelectionMode: QListWidget and Multiple Selection
But the combobox does not seem to have it. And I don't remember seeing a combobox with multi selection on.
No, you can't select multiple item from a QComboBox instance. It can be used to select only one item at once. If you want to have multiple selection in your widget have to use a QListView/Widget.

VB Getting the selected item from a List View

I have a list view with two columns and I'd like to be able to save the value of the leftmost column for the selected row, or even better make it so that once the user clicks on either the right or left column of any given row, the entire row selects and not only the field that was clicked.
However I'm struggling to get the field saved which is more crucial than the row highlighting.
In a list box it would be
string = listbox1.selecteditem.tostring
However this doesn't seem to work for the list view. It won't even let me put "Selecteditem" and instead requires I put selecteditems, however this doesn't seem to do what I want either.
When I use the code:
string = ListView1.SelectedItems.ToString
I get the result of
string = "System.Windows.Forms.ListView+SelectedListViewItemCollection"
Despite the selected field actually being "EGG".
I need to have two columns so can't switch to using a listbox, although that seems like it would be the easier solution.
When I tried googling this question I could only find things for C#
Set FullRowSelect on to get the entire row to select.
SelectedItems.ToString refers to the collection of selected items.
SelectedItems(0).Text refers to the first selected item's text property.

Can not select an item in an unbound combo box in access

I have form that is not based on any table and I have a combobox on it that gets it data from a query (which hs id and text).
When I look at form in formview, I can open the dropdown section of combobox and it has values from the query, but I am not able to selct it. I tried to select it by any of the following ways:
1- Clicking on an item.
2- DBClicking on an item
3- Pressing ener on an item.
What is the problen and how can I fix it?
I am using Accesss 2003 on windows XP
Have you by accident set the Locked property to Yes? You can still drop down a locked combo-box but can't select any items.
See if your Form has property Allow Edits set to True.

Gray out a form row's (detail's) button conditionally with VBA code

I have a standard form in MS-Access which lists a bunch of orders, and each row contains order no, customer, etc fields + a button to view notes and attached document files.
On request from our customer we should gray out the button btnAnm (or check or uncheck a checkbox) depending on a calculation from two queries to two other tables (a SELECT COUNT WHERE and a check if a text field is empty).
I've tried btnAnm_BeforeUpdate(...) and btnAnm_BeforeRender(...) and put breakpoints in the subs, but none of them trigger. The same if I use the control Ordernr instead of btnAnm.
I'd like a function in the Detail VBA code to be triggered for each "Me." (row) so to speak, and set the row's control's properties in that sub.
What do I do? I've looked at the help file and searched here.
*Edit: So I want to do something that "isn't made to work that way"? Ie. events are not triggered in Details.
As an alternative, could I base the value of a checkbox on each line on a query based on the 'Ordernr' field of the current row and the result of a SELECT COUNT from another table and empty field check?
Do I do this in the query the list is based on, or can I bind the extra checkbox field to a query?
A description of how to do this (combine a COUNT and a WHERE "not empty" to yes/no checkbox value) would be perfectly acceptable, I think! :)*
You cannot do much with an unbound control in a continuous form, anything you do will only apply to the current record. You can use a bound control with a click event so that it acts like a button.
Presumably the related documents have a reference to the order number that appears on your form, which means that you can create a control, let us call it CountOrders, with a ControlSource like so:
=DCount("OrderID","QueryName","OrderID=" & [OrderID])
The control can be hidden, or you can set it up to return true or False for use with a textbox, you can also use it for Conditional Formatting, but sadly, not for command buttons.
Expression Is [CountOrders]>0
You can also hide the contents and add a click event so that is acts in place of the command button. Conditional Formatting will allow you to enable or disable a textbox.
As I understand your question, you have a continuous form with as command button that appears on each row - and you'd like to enable/disable the button conditionally depending on the contents of the row.
Unfortunately you can't do that. It seems that you can't reference the individual command buttons separately.
Having wanted to do something similar in the past I came up with two alternate ways of setting up my interface.
Put a trap into the onClick code for the Button. Which is icky, because it is counter intuitive to the user. But it gets you that functionality now.
Move the command button (and editable fields) up into the form header, and make the rows read only. Your users then interact with the record only in the header, and select the record they want work with in the list below. As I recall this is known a Master-Detail interface.

problem with selecting a rows in advanced datagrid using keydown event

I have advanced datagrid with list of items is displayed.I am using keydown for selecting the rows.But the actual problem is when i am selecting the items after the 2nd item it should move to the 3rd item but instead of that its moving back to the 1st item.I have defined selectionmode property to singlerows even then the result same to be same.can any one give me the soloution.
i have resolved this issue..it was related to binding problem what we had in datgrid.