Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 December 13th, 2006, 12:28 PM
Authorized User
 
Join Date: Mar 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Listview doesnt change after items are selected.

I have a really strange problem with a listview on a windows form.I have a listview that lists employees, select an employee and hit the button to bring up a form with their information. If you select an item/click the button going down the listview, the program works correctly. BUT, if you try to select an item above one that you selected before, it will not populate the employee form. What really has me baffled is that it is not consistent, sometimes it works for three different selections, sometimes it only works for two different selections.
Is this a problem with the listview's Index Changed event?


Code:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
        'check selecteditem.length

        If ListView1.SelectedItems.Count > 0 Then


            Try
                empLname = Trim(ListView1.SelectedItems.Item(0).Text)
                empFname = Trim(ListView1.SelectedItems.Item(0).SubItems(1).T ext)
                Dim g As New Guid(ListView1.SelectedItems.Item(0).SubItems(3).T ext)
                empID = g

            Catch ex As Exception
                MsgBox(ex.ToString, MsgBoxStyle.OKCancel, "Error!")

                Exit Try
                Exit Sub
            Finally

            End Try

        End If



    End Sub

I would appreciate any input here.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Change color of items in a ListView eresina Pro VB 6 6 September 15th, 2016 05:09 PM
How to get selected item from listview? try.test.abc C# 1 January 4th, 2007 02:34 AM
how to update table with listview items Singh591 Pro VB.NET 2002/2003 0 December 30th, 2006 11:13 PM
How to change color of selected external listview method VB How-To 8 October 20th, 2006 07:01 PM
Writting listview items to xml document chandler7272 C# 0 June 12th, 2006 06:01 AM





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