1 Replies - 524 Views - Last Post: 14 January 2013 - 09:33 PM Rate Topic: -----

#1 Jheroll  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 08-January 13

Problem transferring listview column 2 items to textbox

Posted 14 January 2013 - 06:50 PM

Hi ., does anyone know how to transfer selected item from column 2 of a listview to a textbox..?

TextBox8.Text = ListView2.SelectedItems(0).Text


This code only transfer item from the first column..

Please help :)
Thank you in advance :))

Is This A Good Question/Topic? 0
  • +

Replies To: Problem transferring listview column 2 items to textbox

#2 kai_itz me  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 159
  • Joined: 03-August 12

Re: Problem transferring listview column 2 items to textbox

Posted 14 January 2013 - 09:33 PM

(FOR THIS U NEED THE TEXTBOX AS MANY AS U HAVE COLUMNS) FOR EXAMPLE IF U WANT TO COPY DATA FROM 4 COLUMNS U NEED 4 TEXTBOX.

HERE I HAVE TAKEN 3.

Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged



        '  Copy the data from the listview into the textboxes
        '  If you only have a few columns then this will be OK:
        Try
            With ListView1
                '  Check that a selection has been made/remade
                If .SelectedIndices.Count > 0 Then
                    TextBox1.Text = .Items(.SelectedIndices(0)).Text
                    TextBox2.Text = .Items(.SelectedIndices(0)).SubItems(1).Text
                    TextBox3.Text = .Items(.SelectedIndices(0)).SubItems(2).Text
                End If
            End With
        Catch ex As Exception

        End Try
    End Sub



This post has been edited by kai_itz me: 14 January 2013 - 09:33 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1