473,730 Members | 4,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listview Selected Item

I'm trying to convert a vb6 program to vb.net (vb2008 express)

I have text data in a Listview Control
I use a Textbox to enter characters to search the Listview
When a Match is found, I use textbox_textcha nged to select listview item

Listview1.Items (z).Selected = True
Listview1.Items (z).EnsureVisib le ()
Listview1.Items (z).FullRowSele ct = True
Listview1.Items (z).ForeColor = Blue

This works fine .

Then when I hit a Aarrow key in the textbox
I set focus to the listview (Listview1.Focu s()

Now if I hit a arrow key to scroll the listview, it jumps to the last place
that was Physically selected. or in case of the first hit it starts at the
top of the listview.

In vb6 the same code would start the listview scroll from the selected item.

What am I missing ????
Jan 26 '08 #1
4 13860
On Jan 26, 7:09*pm, "Bill-R" <Bi...@yahoo.co mwrote:
I'm trying to convert a vb6 program to vb.net (vb2008 express)

I have text data in a Listview Control
I use a Textbox to enter characters to search the Listview
When a Match is found, I use textbox_textcha nged to select listview *item

Listview1.Items (z).Selected = True
Listview1.Items (z).EnsureVisib le ()
Listview1.Items (z).FullRowSele ct = True
Listview1.Items (z).ForeColor = Blue

This works fine .

Then when I hit a Aarrow key in the textbox
I set focus to the listview (Listview1.Focu s()

Now if I hit a arrow key to scroll the listview, it jumps to the last place
that was Physically selected. or in case of the first hit it starts at the
top of the listview.

In vb6 the same code would start the listview scroll from the selected item.

What am I missing ????
If the same code was working with no problem in VB6, i recommend you
to check the listview control's "properties " in properties window.
Compare both platform's listviews to ensure they have the same
properties of VB6's.
Jan 26 '08 #2

"Bill-R" <Bi***@yahoo.co mkirjoitti viestissä
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
I'm trying to convert a vb6 program to vb.net (vb2008 express)

I have text data in a Listview Control
I use a Textbox to enter characters to search the Listview
When a Match is found, I use textbox_textcha nged to select listview item

Listview1.Items (z).Selected = True
Listview1.Items (z).EnsureVisib le ()
Listview1.Items (z).FullRowSele ct = True
Listview1.Items (z).ForeColor = Blue

This works fine .

Then when I hit a Aarrow key in the textbox
I set focus to the listview (Listview1.Focu s()

Now if I hit a arrow key to scroll the listview, it jumps to the last
place that was Physically selected. or in case of the first hit it starts
at the top of the listview.

In vb6 the same code would start the listview scroll from the selected
item.

What am I missing ????
When setting focus to Listview1, try this code:

ListView1.Items (z).Focused = True

-Teemu

Jan 26 '08 #3

"Teemu" <ts*****@hotmai l.comkirjoitti viestissä
news:Jg******** ************@re ader1.news.saun alahti.fi...

Or actually my answer was a bit wrong.

When selecting the item:

Listview1.Items (z).Selected = True
Listview1.Items (z).Focused= True
Listview1.Items (z).EnsureVisib le ()
Listview1.FullR owSelect = True
Listview1.Items (z).ForeColor = Blue

And then

Listview1.Focus ()

to activate the Listview1.

-Teemu

Jan 26 '08 #4
Thanks Teemu !!!!
Was driving me crazy
quite a learning curve for me using .net !
"Teemu" <ts*****@hotmai l.comwrote in message
news:_i******** *************@r eader1.news.sau nalahti.fi...
>
"Teemu" <ts*****@hotmai l.comkirjoitti viestissä
news:Jg******** ************@re ader1.news.saun alahti.fi...

Or actually my answer was a bit wrong.

When selecting the item:

Listview1.Items (z).Selected = True
Listview1.Items (z).Focused= True
Listview1.Items (z).EnsureVisib le ()
Listview1.FullR owSelect = True
Listview1.Items (z).ForeColor = Blue

And then

Listview1.Focus ()

to activate the Listview1.

-Teemu
Jan 26 '08 #5

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

Similar topics

13
3769
by: Maheshkumar.R | last post by:
hi groups, I have placed an listview control, i want to iterate thru the control and find the clicked event items. listView2.Items.Add(fname.ToString(), i); how i can perform the iteration to find the item clicked...? and its item. thankz-- Mähésh Kumär. R
9
3050
by: Devron Blatchford | last post by:
Hi there, Just wondering if I change the back and fore colour of a listview item when the mouse hovers over it? I want to overide the default windows colour. Can someone please tell me how to do this? Thanks Devron
1
4027
by: Shane | last post by:
I have a text box select items in a listview as text is being typed into the text box. I get the select bar to move correctly in the Listview control. If the user presses the down or up key in the text box, I want to move to the selected item in the listview box. The down or up arrow does set focus to the listview box and the selected item switches from the grey of being unfocused to the blue of focus. So far, so good.
4
4958
by: Shane | last post by:
I have a text box select items in a listview as text is being typed into the text box. I get the select bar to move correctly in the Listview control. If the user presses the down or up key in the text box, I want to move to the selected item in the listview box. The down or up arrow does set focus to the listview box and the selected item switches from the grey of being unfocused to the blue of focus. So far, so good.
6
22171
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
5
10084
by: Phill W. | last post by:
(VB'2003) What's the correct way to remove multiple, selected items from a ListView control (say, from a ContextMenu)? I ask because I'm getting a very annoying ArgumentOutOfRangeException because the ListView seems to be trying to "re-select" items that are no longer there! for example, giventhat I have 3 items in my list: Select the first and remove it - no problem.
6
5546
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...
4
2669
by: spowel4 | last post by:
My form has a listview populated with the 50 states. When the user checks the checkbox within the listview for a particular state, I need to retrieve which state was checked (i.e. if AZ is checked I need to get the text AZ) and search through an array for matching text. When matching text is found I need to populate another listview with some information. So if the array is two-dimensional and I'm looking at elements (0,0 ... 0,7) for...
5
2553
by: Bart Steur | last post by:
Hi, What's the best way to programmaticly select (click) another listview Item after removing the selected/focused one. using VB2005 Express. Thanks Bart
12
4028
by: Tom Bean | last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an item in a ListView and have encountered a something that seems strange to me. When the ListView is initially populated, no items are selected. When the first item is selected by clicking either the left or right button, the SelectedIndexChanged event fires but not the MouseUp event. After the first item is selected and another item clicked on, both the...
0
8943
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
8770
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
9300
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
9229
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,...
1
6725
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
4542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3257
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2712
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2175
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.