Hi Group!

I'm curious to know, is it is possible to build a custom control in Visual Basic?

Specifically, I want to build a control that would be similar that would be similar to a ListView (in the Detail "view"). However the difference would be in how it actually displays. Whereas the ListView displays selected data in horizontal manner one line at a time, I would like to display the data over 3 lines with the fields in varible widths.

I've created a 'Panel' in the past with multiple TextBoxes to make up my "ListView". However I wasn't happy the way in behaved and found it difficult to select (click) the panel to edit the fields. The true ListView works much better. However I want to rearrange it architecture to have it display differently.

Can this be done? If it can be, could you direct me where I might look to find how this is done?

Thanks again! You guys have been a great help in the past. Thanks for all you do.

Don

Try googling

how to create custom control in vb.net 2010
Member Avatar for deletedaccount

If you want to make a custom listview, I highly recommend you learn GDI+. With GDI+ you can make your own custom forms, buttons, tabcontrols and yes, listviews. Another thing you could do, is make a class and just modify the existing control "listview" instead of making it from scratch. You can just 'inherit' the Windows.Forms.ListView and then make a public sub new. So, to get you started, make a class and make the code the following:

Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms

Public Class customListViewControl
    Inherits Windows.Forms.ListView

    Public Sub New
        ' put your designer code here
        ' for example, you could put a property item and change it here.

        Me.Width = 100
        Me.Height = 100
        Me.BackColor = System.Drawing.Color.White
        Me.ForeColor = System.Drawing.Color.Black

        ' put the rest of the default properties and then add your own features.
    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.