Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was hoping to find a simple answer. Just looking for a simple construct, or example.
I just want a blank listview control like the one that is preloaded, so I can more customizable.

Here is the code I have made so far:

Public Class Enhancedlistview
    Inherits ListView

    Public Sub New()
        MyBase.New


        ' Me.SuspendLayout()
        Me.AllowColumnReorder = True
        Me.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
        Or System.Windows.Forms.AnchorStyles.Left) _
        Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.FullRowSelect = True
        Me.GridLines = True
        Me.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None
        Me.HideSelection = False
        Me.LabelWrap = False
        Me.MultiSelect = False
        Me.Name = "listviewex"
        Me.OwnerDraw = True
        Me.TabIndex = 0
        Me.UseCompatibleStateImageBehavior = False
        Me.View = System.Windows.Forms.View.Details
        Me.ResumeLayout(False)


        'add columns
        Me.Columns.Add("Nonselectableside", 150, HorizontalAlignment.Left)
        Me.Columns.Add("editableside", 150, HorizontalAlignment.Left)
    End Sub

End Class


however, when I try to drag and drop the control I keep getting an error "Failed to load toolbox item "Enhancedlistview", it will be removed from the toolbox"

I created this in a class, is this the correct way to make a listview control?

What I have tried:

I tried to add size values to it and location values but it still does not work.
Posted
Updated 17-May-18 9:17am
v2
Comments
Ralf Meier 17-May-18 16:06pm    
Your Control is working for me - but it makes also no sense for me.
So ... what are you trying to achieve ... or what is your goal ?
Member 11856456 17-May-18 18:12pm    
I have additional code that will be added to it. I am just wanting to have my own version of the listview control. It will have its own functionality, which is mouseclick that embeds a textbox into the listview subitem and then once I am done editing the cell I can hit enter and got to the next subitem and do the same thing. The problem is when I go to make my own listview, it never shows up and I get that error mentioned above. So, I figured that I was missing something in the initial code that would make it appear, or contain it.
Ralf Meier 18-May-18 7:22am    
As I wrote before ... your Control is working for me (and on my System).
So - please explain exactly whats going wrong and what are you doing at this Moment.
My Problem at this Moment is that I don't understand where you stuck ... and I also don't understand (with this little code) what you are trying to do ...
Member 11856456 18-May-18 9:20am    
Are you running it in a 64x environment? Because that is where I am having my issue. It will not let me drag and drop this control or any control that I have created in listview if my build is 64x. I am not understanding why that would be a problem, because the initial listview that already comes in the toolbox can be used in a 64x program.
Ralf Meier 18-May-18 16:31pm    
OK ... does you .Net-Framework supports the x64-Mode ?

1 solution

 
Share this answer
 

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