VB School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB Expert!

Join 307,168 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,531 people online right now. Registration is fast and FREE... Join Now!




Returning Values from a Listview

 

Returning Values from a Listview, Need to return values from a listview

Bruno43

6 Nov, 2007 - 01:59 PM
Post #1

New D.I.C Head
*

Joined: 6 Nov, 2007
Posts: 3


My Contributions
The below code is what I have inputing the information from a DataBase.

I want to be able to click a row and have that row once clicked pass the ID that is in the 5th column to a variable. I have been searching for a couple hours now and have not gotten anywhere with this.
(I have, however, won 3 Ipods and a iPhone lol)

Anyways, I am sure it is a simple solution any help will be appreciated. Thank You!

CODE
While OledbRead.Read()
          

            listviewitem = New ListViewItem((OledbRead.Item("decFN")).ToString)
            listviewitem.SubItems.Add((OledbRead.Item("decLN")).ToString)
            listviewitem.SubItems.Add((OledbRead.Item("CompanyName")).ToString)
            listviewitem.SubItems.Add(strUrgent)
            listviewitem.SubItems.Add((OledbRead.Item("CallID")).ToString)
            mainPage.ListView1.Items.Add(listviewitem)
        End While

        'Creates some column headers for the data.
        columnheader = New ColumnHeader()
        columnheader.Text = "First Name"
        columnheader.Width = 85
        mainPage.ListView1.Columns.Add(columnheader)

        columnheader = New ColumnHeader()
        columnheader.Text = "Last Name"
        columnheader.Width = 85
        mainPage.ListView1.Columns.Add(columnheader)

        columnheader = New ColumnHeader()
        columnheader.Text = "Customer"
        columnheader.Width = 160
        mainPage.ListView1.Columns.Add(columnheader)

        columnheader = New ColumnHeader()
        columnheader.Text = "Urgent"
        columnheader.Width = 75
        mainPage.ListView1.Columns.Add(columnheader)

        columnheader = New ColumnHeader()
        columnheader.Text = "Customer"
        columnheader.Width = 0
        mainPage.ListView1.Columns.Add(columnheader)


User is offlineProfile CardPM
+Quote Post


Bruno43

RE: Returning Values From A Listview

7 Nov, 2007 - 06:21 AM
Post #2

New D.I.C Head
*

Joined: 6 Nov, 2007
Posts: 3


My Contributions
Hey I figured out, in a way, to pass the information with
CODE

MsgBox(ListView1.SelectedItems.Item(0).SubItems(4).ToString)

But it displays

ListViewSubItem: {1}

All I want is that 1

Is their an easier way to just extract that 1?
User is offlineProfile CardPM
+Quote Post

Bruno43

RE: Returning Values From A Listview

7 Nov, 2007 - 06:31 AM
Post #3

New D.I.C Head
*

Joined: 6 Nov, 2007
Posts: 3


My Contributions
I figured it out, just changed the .ToString to .Text
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 06:33PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month