lol Hi people its been 2 years im back :D

I finshed high school but had too stop programming so im back to noob

The problem is i cant seem to find SelectedIndex while using listview -__-

I really dont want to use text to find a item :/

Edited by VB 2012: Spelling :(

4 Years
Discussion Span
Last Post by Minimalist

Maybe i should use text then
Can you help me with a example using text of a item ?
Getting exception around every corner xD


the text of selected item in listview

ListView1.SelectedItems(ListView1.SelectedItems.Count - 1).text

Edited by oussama_1


Im sorry for not making this clear
Im looking for a more specific way for example
ListView1.Selectedtext < something like that


In my Listview i have a couple of items each with their own values that needs to be calculated after i select one of them a inputbox will arise and ask a amount of that item do see where im going here lol ? sorry for any inconvience i may have caused you


Here is just some basic code. Add items in formload. When an item is clicked in listview1 it is copied totextbox1. Where I copy the text you have to insert the code you need.

Public Class Form1

    Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
        Dim IntInd As Integer = ListView1.FocusedItem.Index
        TextBox1.Text = ListView1.Items(ListView1.FocusedItem.Index).SubItems(0).Text()
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub
End Class
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.