Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
hi to all.
i got code from one of the link:<a href="http://stackoverflow.com/questions/5934422/how-can-i-remove-the-checkboxes-from-individual-items-in-a-listview-control">http://stackoverflow.com/questions/5934422/how-can-i-remove-the-checkboxes-from-individual-items-in-a-listview-control</a>[<a href="http://stackoverflow.com/questions/5934422/how-can-i-remove-the-checkboxes-from-individual-items-in-a-listview-control" target="_blank" title="New Window">^</a>]
this code will be for hideing check boxes in listview..

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

last method like hide check box method , in that lvi.iItem=item.index; this iam getting error..i tried but not get it..
if anybody knows pls let me know...
its very urgent for me..
Posted
Comments
snorkie 22-Nov-11 9:47am    
What error are you getting?
BillWoodruff 22-Nov-11 21:47pm    
why not post a question on StackOverFlow on the the thread that contains the answer you are using ?

And, as Snorkie comments: what's the error ?

WinForms ?
narmadhalilly 23-Nov-11 3:52am    
can not convert int to intptr like that in lvi.iItem = item.Index

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900