Windows Develop Bookmark and Share   
 index > Windows Forms General > listview problems
 

listview problems

i've got a few problems using a listview....
what i want is to select a item from a listview and a a form appears
i've tried this:

If ListViewcons.FocusedItem Is ListViewcons.Items(1) Then
     Dim openem As New Formcreateemp()
            openem.MdiParent = Formcreateemp.ActiveForm
            openem.Show()
   End If

 it works...but when i close the forum the focus is in item 1, if i select item 0, the forum associated in item 1 tags along.....
also i've tried this

 If ListViewcons.SelectedItems Is ListViewcons.Items(0) Then
            Dim newemp As New Formopenemp()
            newemp.MdiParent = Formopenemp.ActiveForm
            newemp.Show()
        End If
doesn't do a thing
any help would be appreciated

paxa  Tuesday, December 13, 2005 1:38 AM

If I understand correctly what you are trying to achieve, all you would need to do is respond to the SelectedIndexChanged event from the listview. Check if the SelectedItem is not Nothing, or if the SelectedIndex not is -1, and open the form if so. You can also check specific indices, but I wouldn't want to be dependent on indices, I'd rather do an alternative check depending on the contents of the object in the ListView.

Does that answer your question or did I completely misunderstood?

Jelle van der Beek2  Tuesday, December 13, 2005 12:10 PM

If I understand correctly what you are trying to achieve, all you would need to do is respond to the SelectedIndexChanged event from the listview. Check if the SelectedItem is not Nothing, or if the SelectedIndex not is -1, and open the form if so. You can also check specific indices, but I wouldn't want to be dependent on indices, I'd rather do an alternative check depending on the contents of the object in the ListView.

Does that answer your question or did I completely misunderstood?

Jelle van der Beek2  Tuesday, December 13, 2005 12:10 PM

You can use google to search for other answers

Custom Search

More Threads

• Default MSI Property Value for Merge Module
• printing blank pages
• The WebBrowser control and Internet Explorer settings
• using the container (member's of form1)of form1 in form2
• ScrollableControl & wheel tilt?
• multicolumn listbox in .net compact framework
• How to implement printing in custom user control
• How to display "&&" characters in Menu Items using .Net
• creating a custom textbox to display bitmaps instead of characters
• Help Please