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 4576090
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:09:23+00:00 2026-05-21T20:09:23+00:00

This is a followup question to another question I asked earlier. I thought I

  • 0

This is a followup question to another question I asked earlier. I thought I had everything I needed, but I’m running into another issue. I’m trying to use a custom listviewitem class that attaches additional information to a lisview item. Here is the class:

Public Class albumListViewItem
    Inherits ListViewItem
    Public hash As String
    Public id As Integer
    Public provider As String
    Public providerID As String
    Public providerURL As String
    Public providerArtistID As String
    Public albumName As String
    Public albumType As String
    Public numTracks As Integer
    Public imageURLs() As String
    Public genres() As String
    Public styles() As String
    Public label As String
    Public year As String
    Public country As String
    Public rating As String
    Public editorsPick As Boolean
    Public sampleStreamURL As String
    Public providerReview As String
End Class

When I try to cast a listviewitem to my custom class like this:

Dim albumItem As albumListViewItem = CType(lsvHidden.items.item(0), albumListViewItem)

I get the following error, “Unable to cast object of type ‘System.Windows.Forms.ListViewItem’ to type ‘AudioMatic.albumListViewItem’.”

What am I missing here?

  • 1 1 Answer
  • 2 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-21T20:09:24+00:00Added an answer on May 21, 2026 at 8:09 pm

    From your previous question and this one, I think a better fit for your problem would be to use a regular ListViewItem and store the accessory information in ListViewItem.Tag

    You can do

    Dim listViewItem As New ListViewItem("SomeText")
    Dim albumInfo As New albumListViewItem()
    
    albumInfo.albumName = "SomeAlbum"
    ...
    listViewItem.Tag = albumInfo
    
    listView1.Items.Add(listViewItem)
    

    and then retrieve it like this

    Dim selectedItem As ListViewItem = listView1.SelectedItems(0).Item
    Dim alubmInfo As albumListViewItem = TryCast(selectedItem.Tag, alubmListViewItem)
    
    Dim albumName as String = albumInfo.albumName
    

    see if this solution will work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a followup to another question I asked earlier ( Earlier redirect question
This is a followup to a question I posted yesterday. I thought everything was
This is a follow-up to another question I asked earlier today. I am creating
This is a followup to another question I asked abou creating your own hooks.
I had asked a question earlier( How to keep this counter from reseting at
This is a followup to an earlier question ( Help Refining RegEx ("\b\d{6}([ ]{1,15})\d{7}\b")
This is a followup to my earlier question : SELECT s.unique_id, s.counter, s.sequence_length, s.yearmonth,
This is a followup/post question to another question; as I have discovered a solution
This is a follow up of another question I asked last night. My problem
This is a follow up question from another post but that post was answered.

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.