473,320 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

listview issues

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. 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. Is there any way to make it so the listview
does not lose focus.. allowing the up and down arrows to work, all the while
refreshing the data on the form? Thanks in advance

-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
Nov 20 '05 #1
5 1365
Just because it looses focus doesent mean it looses 'Selection', what
problem are you seeing ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
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. 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. Is there any way to make it so the listview
does not lose focus.. allowing the up and down arrows to work, all the while refreshing the data on the form? Thanks in advance

-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

Nov 20 '05 #2
Whenever I use my down arrows or up arrows to move through the list, it will
move once. The html edit control will fill with the new data, and then any
attempt to use the down or up arrow to move to the next message results in
the scrolling of the html edit control. The block around the selection
turns grey, instead of blue like it should be.
-Matt

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Just because it looses focus doesent mean it looses 'Selection', what
problem are you seeing ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
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. 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. Is there any way to make it so the listview
does not lose focus.. allowing the up and down arrows to work, all the

while
refreshing the data on the form? Thanks in advance

-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


Nov 20 '05 #3
Actually Matt, Im a little confused here regarding this HTML edit control
you are referring to. Is this a Web Project and you are referring to a multi
line textbox ? or is this a Windows Forms project and this is some 3rd Party
control ?

Actually, post your code as well

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
Whenever I use my down arrows or up arrows to move through the list, it will move once. The html edit control will fill with the new data, and then any attempt to use the down or up arrow to move to the next message results in
the scrolling of the html edit control. The block around the selection
turns grey, instead of blue like it should be.
-Matt

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl...
Just because it looses focus doesent mean it looses 'Selection', what
problem are you seeing ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
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. 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. Is there any way to make it so the listview does not lose focus.. allowing the up and down arrows to work, all the

while
refreshing the data on the form? Thanks in advance

-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



Nov 20 '05 #4
This is not a web project, but it's a control that allows display of HTML.
I'm getting the messagebody from a dataset, and using a string builder to
load
messageBody = Convert.ToString(msg.Tables("Message").Rows(0)("Me ssageBody"))

Dim sb As StringBuilder = New StringBuilder

Dim body As String
sb.Append("<html><head>")sb.Append("</head>")

sb.Append("<body>")

sb.Append(messageBody)

sb.Append("</body></html>")

body = sb.ToString

deMessage.LoadDocument(body)


"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
Actually Matt, Im a little confused here regarding this HTML edit control
you are referring to. Is this a Web Project and you are referring to a multi line textbox ? or is this a Windows Forms project and this is some 3rd Party control ?

Actually, post your code as well

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
Whenever I use my down arrows or up arrows to move through the list, it will
move once. The html edit control will fill with the new data, and then

any
attempt to use the down or up arrow to move to the next message results in
the scrolling of the html edit control. The block around the selection
turns grey, instead of blue like it should be.
-Matt

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Just because it looses focus doesent mean it looses 'Selection', what
problem are you seeing ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
> 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. 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. Is there any way to make it so the listview > does not lose focus.. allowing the up and down arrows to work, all the while
> refreshing the data on the form? Thanks in advance
>
> -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
>
>



Nov 20 '05 #5
Sorry about the last message.. it wasn't complete (obviously). This is not
a web project, but it uses a control that allows display of html. The
control is displayed by issuing the LoadDocument method of the HTML control.
The messagebody is grabbed from a dataset and, used to display the document
in the HTML control. In the else clause, when the selectedItems < 0 the
EmptyMessageFields() simply builds a similar string, except it's a blank
document. The control is called HtmlEdit, but it references
Microsoft.mshtml.
messageBody = Convert.ToString(msg.Tables("Message").Rows(0)("Me ssageBody"))

Dim sb As StringBuilder = New StringBuilder

Dim body As String

sb.Append("<html><head>")

sb.Append("</head>")

sb.Append("<body>")

sb.Append(messageBody)

sb.Append("</body></html>")

body = sb.ToString

deMessage.LoadDocument(body)

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.

Thanks

-Matt

One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
Actually Matt, Im a little confused here regarding this HTML edit control
you are referring to. Is this a Web Project and you are referring to a multi line textbox ? or is this a Windows Forms project and this is some 3rd Party control ?

Actually, post your code as well

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
Whenever I use my down arrows or up arrows to move through the list, it will
move once. The html edit control will fill with the new data, and then

any
attempt to use the down or up arrow to move to the next message results in
the scrolling of the html edit control. The block around the selection
turns grey, instead of blue like it should be.
-Matt

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Just because it looses focus doesent mean it looses 'Selection', what
problem are you seeing ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Matt Michael" <ih***@spamforme.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
> 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. 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. Is there any way to make it so the listview > does not lose focus.. allowing the up and down arrows to work, all the while
> refreshing the data on the form? Thanks in advance
>
> -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
>
>



Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Randy Birch | last post by:
Reposted as the original is reported as deleted from the server. re: MSComCtl Listview control cashes after installing VB6/VS6 SP6 I have been advised that this problem has been reproduced...
5
by: Simon Middlemiss | last post by:
I am writting a program to manage DTS packages which is based on the code example at the following link http:\\www.support.microsoft.com/?kbid=319985. I need to do things in a Windows Forms...
7
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I'v been struggeling with removing selected items from a listview. Anyone that can give me a piece of code that does this? I am a newbee to this C# and cant figure it out.... Regards...
6
by: Dave | last post by:
VB6 has a SorkKey property that you can setup on the ListView control to tell the ListView what column to use for sorting. In .NET there is a Sort() method and a SortOrder property that you can...
4
by: gene kelley | last post by:
I had a VB6 app that used a third party ListView control to simply display various recordsets. The control had a VirtualMode which I used for this display. Now in VB2005, I want to do the same...
3
by: Michael.Suarez | last post by:
Is it me, or does it seem like they put no effort into creating the listview control in .Net. listview. A few gripes I have with .Net listview that aren't present in vb6: -Inability to set...
5
by: --== Alain ==-- | last post by:
Hi, Several months ago i've asked some information about the best way how to have some particular columns (progress bar, checkbox, images, color picker,...) in a ListView component. It seems...
6
by: Brandon McCombs | last post by:
Hello, I have a form that contains a listview on the left side and a column of buttons on the right side. Only some of the buttons do I want enabled all the time. The other buttons should be...
5
by: R | last post by:
Minimizing an app that uses a ListView in a custom control causes all entries in the ListView to disappear, never to return. What would affect this?
2
by: cpix | last post by:
hi! i've been reading alot about the backgroundworker, but most of the articals only shows that you can use the progress-event to send a message to the form. Im trying to pass a listview with a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.