views:

31

answers:

1

In my situation there is a textbox that I am typing in it and then there is a listView that jumps to the item I am typing in the text box so the FOCUS should always be in the text box so I can continue typing! But as I said when it is selecting the item in the ListView I want that item to be highlighted with BLUE background as other standard highlights in Windows forms. Is there a way to do this?

thanks.

+1  A: 

Have a look at setting the ListViewItemBackColor, you could change it as they type so it looks as though it has been selected, when it reality all it has is a blue background.

Or you could try setting the colour of the background to blue AND selecting the item and then setting the focus back to the textbox so they can continue typing, although it may not happen quickly enough so key presses may be lost but you'd have to try it and see how well it works.

w69rdy
I just want one item - same as it is typed in the textBox - to be highlighted .. but this sounds to color all the listView items.
BDotA
No it's for individual items in the list
w69rdy
ahh, ok, something like this: lview.Items[0].BackColor = Color.Blue; lview.Items[0].ForeColor = Color.White;but now the problem is that I have to keep track of cells getting clikced by the user and take care of returning their color back to normal once they get out ou selection.... any simpler idea?
BDotA
Ok, lets see what you're trying to do. Why do you want them selected in the first place?
w69rdy
@ w69rdy:there is Selection Form.it has a text box and this list view.when user start typing in the text box it tries to auto complete what user has typed or find the closest match to it.but then I want the same thing to be highlighted in the list view.this list view actually has the list of all available items that the user can find and is currently searching for in the text box.but If I move the focus to the listview then user cannot type anymore in the text box which is wrong!I want while the user is typing the listview also start re acting to that and if found something then Highlight it
BDotA
In that case, why not use the autocomplete feature of the combobox to do all that for you? Does it need to be in a listview for any reason?
w69rdy