listview focus problem

M

Matt Michael

Hi,

I'm having a problem working with a listview in an application I'm writing.
Currently, whenever the selectedindex changed event fires, it loads up a
htmledit control, and other labels on the form, with the current information
associated with the listview item. The control is called HtmlEdit and it
references Microsoft.Mshtml Whenever I click on each item, it works fine,
but it seems that whenever I use the up/down arrows(important) to scroll
through the list, it loses focus, and goes to the htmledit control
whenever the index changes. The problem is that this control receives focus
after I select a message,
and rather I would like to be able to scroll through the list without losing
focus with the down and up arrows, with all the data being refreshed each
time a new item is selected.


-Matt

Sample code:

Private Sub lvMessages_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lvMessages.SelectedIndexChanged

If lvMessages.SelectedItems.Count > 0 Then
....get message..

If msg.Tables("Message").Rows.Count > 0 Then
...display fields
...enable appropriate buttons
deMessage.LoadDocument(body)
End If

Else
....empty message fields..
...disable buttons
End If
End Sub
 
G

Greg Burns

If one wanted to, where can we get our hands on your HtmlEdit control to
test this ourselves?

Can you just set the focus back to your listview after calling
deMessage.LoadDocument(body)?

Greg
 
M

Matt Michael

Hi Greg,

I've tried setting focus back to the listview after the htmledit control is
loaded. It seems that I lose selection whenever I use the up and down
arrows (the color on the listview goes from blue to grey), and it doesn't
allow me to scroll down or up anymore. Whenever I use the up arrow or down
arrow, it will move down or up once, then control goes to the htmledit
control, and it scrolls inside of it. The HtmlEditor control can be found
here:
http://www.itwriting.com/htmleditor/index.php

-Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top