complex control creation

B

Bernie Yaeger

I'm trying to create a custom control that has 2 listviews, in view
smallicon. I'm using these with code that makes them drag/drop controls, so
what I am after is a control that does drag/drop automatically between these
2 listviews. However, I'm running into difficulty - when I add the control
to a form, I have no way of adding items to listview1, since the custom
control is not one listview, but rather two. I've used inherits
windows.system.form.usercontrol, standard with the creation of a windows
control library.

Any ideas how I can have a custom control with 2 listviews but still be able
to access all of the methods, properties, events of either or both of the
listviews in the control?

Thanks for any help.

Bernie Yaeger
 
J

JohnFol

Hi Bernie, this isn't my forte, but I managed to get something working that
may be of help.

I created a class that Inherits System.Windows.Forms.ContainerControl and
then added
Protected Overrides Sub OnLayout(ByVal levent As
System.Windows.Forms.LayoutEventArgs)

Me.Controls.Add(New Windows.Forms.ListView)

Me.Controls.Add(New Windows.Forms.ListView)

End Sub


When I add the compiled dll to another project I can do the following

Dim lb1 As ListView

lb1 = Me.DualListView1.Controls(0)

lb1.Items.Add(New ListViewItem("List box 1"))

Dim lb2 As ListView

lb2 = Me.DualListView1.Controls(1)

lb2.Items.Add(New ListViewItem("List box 2"))



It's not exactly elegent, and there may be better ways of doing it but it
might help





To all, please feel free to add to this, or answer Bernie's question another
way. I'd be interested in a much better thought out answer.
 
B

Bernie Yaeger

Hi John,

I've since found a different way of going about it, but your idea seems
really useful. Tx for the help!

Bernie
 
B

Bernie Yaeger

Hi John,

I exactly duplicated your code but it's not working as you describe. Is
there something else that you're doing?

Bernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top