Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 28-10-2009
Member
 
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:

Quote:
Type 'ListView' undefined.
How to fix this error?
Reply With Quote
  #2  
Old 28-10-2009
Member
 
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
Reply With Quote
  #3  
Old 28-10-2009
Member
 
Join Date: Aug 2009
Posts: 98
Re: Problem with inherits listview in a class component

Already tried that but got this error:

Quote:
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.
Reply With Quote
  #4  
Old 28-10-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 08:18 PM.