473,785 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(importan t) 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_Sele ctedIndexChange d(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles lvMessages.Sele ctedIndexChange d

If lvMessages.Sele ctedItems.Count > 0 Then
....get message..

If msg.Tables("Mes sage").Rows.Cou nt > 0 Then
...display fields
...enable appropriate buttons
deMessage.LoadD ocument(body)
End If

Else
....empty message fields..
...disable buttons
End If
End Sub
Nov 20 '05 #1
5 1385
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***@spamform e.com> wrote in message
news:OZ******** ******@TK2MSFTN GP11.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(importan t) 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_Sele ctedIndexChange d(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles lvMessages.Sele ctedIndexChange d

If lvMessages.Sele ctedItems.Count > 0 Then
...get message..

If msg.Tables("Mes sage").Rows.Cou nt > 0 Then
..display fields
..enable appropriate buttons
deMessage.LoadD ocument(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******** *******@TK2MSFT NGP12.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***@spamform e.com> wrote in message
news:OZ******** ******@TK2MSFTN GP11.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(importan t) 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_Sele ctedIndexChange d(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lvMessages.Sele ctedIndexChange d

If lvMessages.Sele ctedItems.Count > 0 Then
...get message..

If msg.Tables("Mes sage").Rows.Cou nt > 0 Then
..display fields
..enable appropriate buttons
deMessage.LoadD ocument(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***@spamform e.com> wrote in message
news:un******** ******@TK2MSFTN GP09.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******** *******@TK2MSFT NGP12.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***@spamform e.com> wrote in message
news:OZ******** ******@TK2MSFTN GP11.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(importan t) 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_Sele ctedIndexChange d(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lvMessages.Sele ctedIndexChange d

If lvMessages.Sele ctedItems.Count > 0 Then
...get message..

If msg.Tables("Mes sage").Rows.Cou nt > 0 Then
..display fields
..enable appropriate buttons
deMessage.LoadD ocument(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.ToStrin g(msg.Tables("M essage").Rows(0 )("MessageBody" ))

Dim sb As StringBuilder = New StringBuilder

Dim body As String
sb.Append("<htm l><head>")sb.Ap pend("</head>")

sb.Append("<bod y>")

sb.Append(messa geBody)

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

body = sb.ToString

deMessage.LoadD ocument(body)


"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
news:eW******** ******@TK2MSFTN GP12.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***@spamform e.com> wrote in message
news:un******** ******@TK2MSFTN GP09.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******** *******@TK2MSFT NGP12.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***@spamform e.com> wrote in message
news:OZ******** ******@TK2MSFTN GP11.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(importan t)

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_Sele ctedIndexChange d(ByVal sender As

System.Object,
> ByVal e As System.EventArg s) Handles lvMessages.Sele ctedIndexChange d
>
> If lvMessages.Sele ctedItems.Count > 0 Then
> ...get message..
>
> If msg.Tables("Mes sage").Rows.Cou nt > 0 Then
> ..display fields
> ..enable appropriate buttons
> deMessage.LoadD ocument(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
EmptyMessageFie lds() simply builds a similar string, except it's a blank
document. The control is called HtmlEdit, but it references
Microsoft.mshtm l.
messageBody = Convert.ToStrin g(msg.Tables("M essage").Rows(0 )("MessageBody" ))

Dim sb As StringBuilder = New StringBuilder

Dim body As String

sb.Append("<htm l><head>")

sb.Append("</head>")

sb.Append("<bod y>")

sb.Append(messa geBody)

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

body = sb.ToString

deMessage.LoadD ocument(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******** ******@TK2MSFTN GP12.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***@spamform e.com> wrote in message
news:un******** ******@TK2MSFTN GP09.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******** *******@TK2MSFT NGP12.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***@spamform e.com> wrote in message
news:OZ******** ******@TK2MSFTN GP11.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(importan t)

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_Sele ctedIndexChange d(ByVal sender As

System.Object,
> ByVal e As System.EventArg s) Handles lvMessages.Sele ctedIndexChange d
>
> If lvMessages.Sele ctedItems.Count > 0 Then
> ...get message..
>
> If msg.Tables("Mes sage").Rows.Cou nt > 0 Then
> ..display fields
> ..enable appropriate buttons
> deMessage.LoadD ocument(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
11123
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 and a hotfix has been prepared. The supporting KB article and hotfix download link have yet to be posted, but I can provide you with the following information for those requiring an immediate fix:
5
3269
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 Application when various things occur in the package so I have written some custom events to reraise the events caught in the PackageEventsSink class. I also have a listview in details mode with several columns, my problem is that when I try and...
7
34794
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 Martin Arvidsson
6
4804
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 use to manipulate the Sorting property. My question is how do I perform the same functionality as I do in VB6 setting the SortKey and SortOrder with the ListView. Dave
4
6094
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 with the native ListView to display various datasets in VirtualMode. I have a ListView with the VirtualListSize set and the appropriate columns in place which is all similar to the old VB6 app. However, the similarities end there as I can't find...
3
2396
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 tooltiptext of subitems (without the use of a very inconveniant work around). -Inability to display images in subitems (without using the windows api
5
1804
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 that ListView is a complex component and a lot of people advise to build a custom component but not from ListVIew itself. Some use a datagrid component as base component, some build a component
6
5555
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 enabled only if something is selected in the listview. That part specifically works but not very well. It seems that I can only get the buttons to disable if I click off the text of the items in the listview but still within about 10-20 pixels of...
5
1561
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
4573
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 number of strings (in this case, strings of files and directorys). i thought it could be done like this, bwbackup.RunWorkerAsync(lvBackupStatus); ListView lvibwc = (ListView) e.Argument;
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.