Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 734059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:19:42+00:00 2026-05-14T07:19:42+00:00

I have a ListView control on my form set up like this in details

  • 0

I have a ListView control on my form set up like this in details mode:

alt text

What I would like to do, is get all the values of the data cells when the user presses the Delete booking button.

So using the above example, my array would be filled with this data:

values(0) = "asd"
values(1) = "BS1"
values(2) = "asd"
values(3) = "21/04/2010"
values(4) = "2"

This is my code so far:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim items As ListView.SelectedListViewItemCollection = _
    Me.ManageList.SelectedItems
    Dim item As ListViewItem
    Dim values(0 To 4) As String
    Dim i As Integer = 0
    For Each item In items
        values(i) = item.SubItems(i).Text
        i = i + 1
    Next
End Sub

But only values(0) gets filled with the first data cell of the selection (in this case “asd”) and the rest of the array entries are blank. I have confirmed this with a breakpoint and checked the array entries myself.

I’m REALLY lost on this, and have been trying for about an hour now. Any help would be appreciated, thanks 🙂

Also please note that there can only be one row selection at once. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:19:42+00:00Added an answer on May 14, 2026 at 7:19 am

    Costin is right about needing to iterate the subitems and if you’re sure that there’ll only be one selection iterating through the items just confuse things, I’d write it as:

      Dim values As New List(Of String)
      If ManageList.SelectedItems.Count > 0 Then
         For Each item As ListViewItem.ListViewSubItem In ManageList.SelectedItems(0).SubItems
            values.Add(item.Text)
         Next
      End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView control set up in details mode with 5 columns. It
I have a data in my ListView control like: Country State City India U.P.
I have a windows form with a listview control. I set the MultiSelect property
I have a ListView control on my form and I am trying to get
I have a simple 3-column ListView. This control is programatically populated with data from
I'm coding in VS2008 using C#. On my form, I have a ListView control.
I have an ASP.NET 2.0 ListView control (aka:parent) and configured inside this ListView I
I have a ListView Control in WindowsForm and also this Listivew has a checkBox
I have a Winforms App in C# with a ListView control. This ListView shows
I'm having a windows form which contains listview control , where listView1.View = View.Details;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.