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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:47:58+00:00 2026-05-21T22:47:58+00:00

I have a ListView with the columns ‘Name’, ‘Expected’, ‘Total’, and I want to

  • 0

I have a ListView with the columns ‘Name’, ‘Expected’, ‘Total’, and I want to add another column saying ‘Recount’ at the end. The ‘Recount’ column will ideally have a checkbox only if the ‘Expected’ value is larger than the ‘Total’ value.

So far I have got the ListView with columns and can add a check box on the left hand side, but that check box is not under a column heading (though I can probably put another column with no values in there to work around that) and it is on all of the records.

Anyone have any ideas what else I can do?

  • 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-21T22:47:58+00:00Added an answer on May 21, 2026 at 10:47 pm

    This is actually relatively simple to implement, provided that you’re willing to endure the drudgery of P/Invoke to access functionality built into the native Windows control, but not exposed by the .NET FW.

    I demonstrate in my answer here how this exact same thing can be done with a TreeView control, and considering how similar a ListView is to a TreeView, it should not be particularly surprising that this can be done in very much the same way with a ListView.

    Here’s all the code that is required (make sure that you’ve added an Imports declaration for the System.Runtime.InteropServices namespace):

    ' P/Invoke declarations
    Private Const LVIF_STATE As Integer = &H8
    Private Const LVIS_STATEIMAGEMASK As Integer = &HF000
    Private Const LVM_FIRST As Integer = &H1000
    Private Const LVM_SETITEM As Integer = LVM_FIRST + 76
    
    <StructLayout(LayoutKind.Sequential, Pack:=8, CharSet:=CharSet.Auto)> _
    Private Structure LVITEM
       Public mask As Integer
       Public iItem As Integer
       Public iSubItem As Integer
       Public state As Integer
       Public stateMask As Integer
       <MarshalAs(UnmanagedType.LPTStr)> _
       Public lpszText As String
       Public cchTextMax As Integer
       Public iImage As Integer
       Public lParam As IntPtr
    End Structure
    
    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, ByRef lParam As LVITEM) As IntPtr
    End Function
    
    ''' <summary>
    ''' Hides the checkbox for the specified item in a ListView control.
    ''' </summary>
    Private Sub HideCheckBox(ByVal lvw As ListView, ByVal item As ListViewItem)
       Dim lvi As LVITEM = New LVITEM()
       lvi.iItem = item.Index
       lvi.mask = LVIF_STATE
       lvi.stateMask = LVIS_STATEIMAGEMASK
       lvi.state = 0
       SendMessage(lvw.Handle, LVM_SETITEM, IntPtr.Zero, lvi)
    End Sub
    

    And then you can simply call the above method like this:

    Private Sub btnHideCheckForSelected_Click(ByVal sender As Object, ByVal e As EventArgs)
       ' Hide the checkbox next to the currently selected ListViewItem
       HideCheckBox(myListView, myListView.SelectedItems(0))
    End Sub
    

    Producing something that looks a bit like this (after clicking the “Hide Check” button for both the tomato and the cucumber items):

         Sample ListView, with checkboxes removed from individual items

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

Sidebar

Related Questions

I have a ListView with a GridView with 3 columns. I want last column
I have to add two columns in a ListView . One column shows different
I have a listview where I add several columns: LVCOLUMN column; column.mask = LVCF_FMT
I have a listview with several columns. I want to change the column header
Hi i have a listview with diffrent columns ID, Name, Zipcode, City, Country, Phone,
I have a ListView that has two columns, one for a zone name and
I have a Listview in detail mode with 3 columns. I want to set
I have a listview with 2 columns. I can easily populate the first column
I have a ListView with 3 columns (User Name, Active, and Group) The ItemsSource
I have a ListView (GridView) that I want to sort by 2 columns, so

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.