Click here to Skip to main content
11,930,048 members (44,841 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB10.0 User-controls , +
Hi everyone.

I'm trying to create a custom comtrol much similar to a combobox,but wich display a listview instead of a listbox, where you can add/show columns and items as you would in a regular listview control.

The one problem i'm finding is that after i add the custom control to a form to test the control and add columns and items to the listview, the columns and items i added at design-time dissapear when i run the form.

Curiously, at exception of columns and items, every other property i created keeps the values set at design-time.

I'm starting now creating custom controls and i couldn't find a solution for my problem so far.

Thanks in advance for any help you can give, and sorry for my english but it isn't my first language.

Posted 23-May-12 8:12am
VJ Reddy 23-May-12 20:44pm
Thank you for response and for accepting the solution :)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

For the properties of the object set at design to be persisted in the form the DesignerSerializationVisibilityAttribute with the argument DesignerSerializationVisibility.Content is to be used like
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public ReadOnly Property Dimensions() As DimensionData
       Return New DimensionData(Me)
   End Get
End Property
as explained here[^]
Sandeep Mewara 23-May-12 13:43pm
My 5!

Good answer.

Comment from OP:
Thanks a lot.
this worked perfect. I, actually read an article wich says that changes were temporary but couldn't found a solution from there in spite looking for one through there.

Thanks again, a lot
VJ Reddy 23-May-12 20:43pm
Thank you, Sandeep :)
Espen Harlinn 23-May-12 18:18pm
Agree :-D
VJ Reddy 23-May-12 20:43pm
Thank you, Espen :)
losmac 24-May-12 12:00pm
Good answer, +5!
VJ Reddy 25-May-12 6:17am
Thank you, losmac :)
Mika Wendelius 24-May-12 15:02pm
Exactly, my 5.
VJ Reddy 25-May-12 6:18am
Thank you, Mika :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 23 May 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100