1 Answer
1

With c#, you can create your own controls. You have different possibilities to do that.

Derive as class from System.Windows.Forms.Control and add your functionality. This is the most flexible, however most complicated approach.

Derive as class from an existing control which comes close to what you want to do and adapt it (e.g. by overriding OnPaint).

Add a UserControl to your project. You can place other controls on a UserControl much like you place controls on a form.

You can do this in your main assembly (.exe); however, if you do this in a class library (.dll), then you can use it much like an ActiveX control. In .NET, you do not need the "magic" of an ActiveX control. Controls are just classes that derive from Control.

I often derive my own controls from ListBox and override OnPaint in order to display the items in a different way, by adding icons, by using different colors or by displaying text on multiple lines.

This is an example of a ListBox that I customized this way

EDIT:

Are you looking for an alternative to the Collection type of VB6? In C# or VB.NET you use collections of the System.Collections.Generic namespace. List<T> for lists and Dictionary<TKey,TValue> for storing key/value pairs.

Hi Olivier, List means like an object list in Visual Basic 6. I created ActiveX dll project in Visual Basic 6. I have records in a do loop. I will add these records to a list, and then when I referenced this dll(which is created in VB6) in a c# project, I will use the list of records.
–
BertanFeb 20 '12 at 5:03

2

Bertan, you should put more effort in asking the question. What are you trying to achieve? Could you provide an example of the code you have written so far in VB6? Someone has downvoted your question because it is incomprehensible. Nevertheless, I updated my answer. You can do much more things with c# than with VB6. Trying to solve c# problems by using VB6 seems very weird to me.
–
Olivier Jacot-DescombesFeb 20 '12 at 15:01

Hi, Olivier. I use VB6, because I have a software development kit, for a finger print device, written in VB6. That Sdk does not working correctly in C#, directly. So I try to wrap that sdk into an ActiveX dll project with VB6. Then I will use that dll in my C# project.
–
BertanFeb 20 '12 at 22:18

I added an explanation on how to use an ActiveX in c#. Your question should probably have been, "How can I use an ActiveX created with VB6 in .NET?" and has nothing to do with lists.
–
Olivier Jacot-DescombesFeb 20 '12 at 22:55

That title is not exactly what I am looking for, I still want to pass finger print device record list from VB6(ActiveX Project) side to C# side, but it is also an issue for me. I used TlbImp to turn my unmanaged code to managed .net code, it is successfull, but in c# side when I import my dll into a c# project,and try to use my methods, it throws an InvalidCastException ->
–
BertanFeb 21 '12 at 0:14