472,348 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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_textchanged to select listview item

Listview1.Items(z).Selected = True
Listview1.Items(z).EnsureVisible ()
Listview1.Items(z).FullRowSelect = 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.Focus()

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 13728
On Jan 26, 7:09*pm, "Bill-R" <Bi...@yahoo.comwrote:
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_textchanged to select listview *item

Listview1.Items(z).Selected = True
Listview1.Items(z).EnsureVisible ()
Listview1.Items(z).FullRowSelect = 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.Focus()

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.comkirjoitti viestissä
news:%2******************@TK2MSFTNGP05.phx.gbl...
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_textchanged to select listview item

Listview1.Items(z).Selected = True
Listview1.Items(z).EnsureVisible ()
Listview1.Items(z).FullRowSelect = 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.Focus()

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*****@hotmail.comkirjoitti viestissä
news:Jg********************@reader1.news.saunalaht i.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).EnsureVisible ()
Listview1.FullRowSelect = 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*****@hotmail.comwrote in message
news:_i*********************@reader1.news.saunalah ti.fi...
>
"Teemu" <ts*****@hotmail.comkirjoitti viestissä
news:Jg********************@reader1.news.saunalaht i.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).EnsureVisible ()
Listview1.FullRowSelect = 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
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. ...
9
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...
1
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...
4
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...
6
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
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...
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...
4
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...
5
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....
12
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...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

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.