Results 1 to 4 of 4

Thread: Problem with inherits listview in a class component

  1. #1
    Join Date
    Aug 2009
    Posts
    98

    Problem with inherits listview in a class component

    I have a Visual basic.net containing 3 project:
    - The main windows
    - Classes
    - The user controls (CTRLUser)

    I want to add in CTRLUser a "class component" (LVGreen) inheriting a ListView classic. So I:
    Code:
    Public Class LVGreen
        Inherits ListView
    End Class
    Now I have this error:

    Type 'ListView' undefined.
    How to fix this error?

  2. #2
    Join Date
    May 2008
    Posts
    685

    Re: Problem with inherits listview in a class component

    Code:
    Public Class LVGreen
        Inherits System.Windows.Forms.ListView
    End Class

  3. #3
    Join Date
    Aug 2009
    Posts
    98

    Re: Problem with inherits listview in a class component

    Already tried that but got this error:

    The base class 'System.Windows.Forms.ListView' specified for class 'LVGreen' can not be different from the base class 'System.ComponentModel.Component' of one of its other partial types.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,221

    Re: Problem with inherits listview in a class component

    Your custom control is actually split into 2 files:
    - LVGreen.vb, you can freely modify
    - LVGreen.designer.vb used by the designer (by default it is hidden within Visual)
    The class LVGreen is divided into 2 parts through the technique of "partial classes"

    But it requires that different parts of the class defines all the same inherited class, or in the file designer.vb it is said that the class inherits from Component. It is therefore necessary that you change this file (it is usually never change) to set ListView instead of Component

    Incidentally, it is a little weak as the base class is declared in the designer.vb, since it prevents the developer to modify (well, to change easily). I suppose it reflects the will of Microsoft to make Visual Basic as a language "easier" by hiding the complexity of the developer. In C# the base class is declared in the file that the user can edit, which is still more logical.

Similar Threads

  1. Problem with Listview Controls in VB.NET
    By Abel18 in forum Software Development
    Replies: 6
    Last Post: 08-10-2011, 09:10 PM
  2. how to use Vscrollbars with Listview
    By Suffix in forum Software Development
    Replies: 1
    Last Post: 01-10-2011, 11:46 AM
  3. DRM Problem -Security Component Upgrade
    By Buriim in forum MediaCenter
    Replies: 8
    Last Post: 15-01-2011, 03:50 PM
  4. WDTV Live Component Video Problem
    By RAJalias in forum Windows Software
    Replies: 5
    Last Post: 21-12-2009, 02:30 PM
  5. Problem downloading the ActiveX component
    By Sentential in forum Technology & Internet
    Replies: 3
    Last Post: 24-11-2008, 06:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,532,308.36261 seconds with 17 queries