Select a Single Cell in a WebListBox

I want to select a single cell in a web list box but I keep getting thwarted by the row getting selected. Is there a way of preventing the row being selected when the user clicks a cell?

I’m currently setting the ListIndex to -1 in the SelectionChanged event which deselects the row but the display flickers as the row is selected and then deselected.

Any suggestions?

I created a ‘fudge’ that highlights the cell’s colour as it is clicked, then allow the user to change the value below. Here is an example where I created an app that lets me test Chart Director:

http://www.webappdevelopments.com/ChartDirectorTesterWE/chartdirectortesterwe.cgi

Not Perfect, but its one idea.

Thanks David. I’ve got to a similar position but the row still has to be selected and then de-selected.

Can I ask how you are de-selecting your row after the user clicks? The selected/de-select looks more deliberate on your version.

I give the cell a WebStyle which has a background colour of yellow.

Sorry, how do you deselect the Row not the cell. So the user clicks the cell and the row gets selected. You then de-select the row in the code somewhere. How do you do that?

Thanks

I keep a variable of the cell currently highlighted then when another cell is clicked I set the old cell highlight to nil. Here is the CellClick event:

if cellRowClicked >= 0 and cellColumnClicked >= 0 then me.CellStyle(cellRowClicked, cellColumnClicked) = nil 'turn off old style
CellValue.Text = me.Cell(Row, Column)
cellRowClicked = Row
cellColumnClicked = Column
me.CellStyle(cellRowClicked, cellColumnClicked) = styHighlightedCell
updateButton.Enabled = True

Hi David. I don’t seem to be communicating my issue very well. I completely understand how you select and de-select a cell with the styles.

The problem I’m having is that the ROW gets selected and is highlighted in blue. To be able to see the cell that you have selected, you have to de-select the ROW. How are you de-selecting the row?

Thanks for your patience!

Yes, sorry. In the SelectionChanged event I have:
for tempInt As Integer = 0 to me.RowCount - 1
me.Selected(tempInt) = False 'turn off the row selection, otherwise it hides the cell selection
next

[quote=106454:@David Cox]Yes, sorry. In the SelectionChanged event I have:
for tempInt As Integer = 0 to me.RowCount - 1
me.Selected(tempInt) = False 'turn off the row selection, otherwise it hides the cell selection
next[/quote]

I do this too but I also have the SelectedStyle of the listbox so that it mitigates the quick changing of Selected to Unselected. You’ll want to have the SelectedStyle’s font color be black and set the background color to match what it looks like when not selected.