Wrox Programmer Forums
|
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 22nd, 2011, 07:07 PM
Registered User
 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ListView on MDI child form click event

I have created a project with a series of MDI Child forms to display data in different formats. I cannot find how to detect click events on the list view.

A click event on a ListView on a normal form works fine.

A click event on the mdi child form that has the listview on it works fine.

What I want to do is get the index of the item selected in the listview.

I hope this question makes sense.

I have searched this site and MSDN, I cannot find a solution anywhere.

Thanks

Bob Spencer
 
Old July 23rd, 2011, 11:26 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

I'm not completely sure I understand. I can use the ListView's SelectedIndexChanged event to tell when the user clicks on a new item. Note that the event will be called with SelectedIndices empty when it removes the old item from the selection but before it adds the new item to the selection.

I put the control in an MDI child form and it seems to work.

Do you need more than that?

(As an aside, Microsoft seems to provide less support for MDI forms with each release. I don't think their heart is really in MDI.)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old July 23rd, 2011, 01:08 PM
Registered User
 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ListView Events on a MDI Child Form

Rod

Thanks for getting back to me, so promptly.

It must be something to do with the way I have set my project up.

With the help of your book I have used AddHandler to detect events, and it works.

At least I can find which Item is selected.

I have bought a new machine and jumped from Windows ME to Vista, and VB3 to VB2010, I quess the learning curve was more like a cliff than a gentle gradient.

I created a sub routine to handle SelectedIndexChanged as you suggested with just a MsgBox in it, but it was never called!

Anyway I have a work round thanks to you.


Bob Spencer.
 
Old July 23rd, 2011, 02:36 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Yes, VB 3 to .NET is a pretty big jump.

If you zip up the project and email it to me, I'll take a look. I don't know why it shouldn't work.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying MDI Child Form Menus with MDI Parent ashu_from_india Pro VB 6 3 June 10th, 2008 11:01 PM
Controlling MDI child form from MDI parent panel LuxCoder Pro Visual Basic 2005 1 May 25th, 2007 12:20 PM
Controlling MDI child form from MDI parent panel LuxCoder VB.NET 2002/2003 Basics 7 April 11th, 2007 02:38 PM
Controlling MDI child form from MDI parent panel LuxCoder Visual Basic 2005 Basics 2 April 9th, 2007 03:24 PM
Opening MDI Child on Button Click of MDI Child Sachin Shinde Visual Studio 2005 0 June 8th, 2006 05:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.