Click here to Skip to main content
11,409,801 members (60,248 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: 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 at 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 at 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 at 23-May-12 20:43pm
Thank you, Sandeep :)
Espen Harlinn at 23-May-12 18:18pm
Agree :-D
VJ Reddy at 23-May-12 20:43pm
Thank you, Espen :)
losmac at 24-May-12 12:00pm
Good answer, +5!
VJ Reddy at 25-May-12 6:17am
Thank you, losmac :)
Mika Wendelius at 24-May-12 15:02pm
Exactly, my 5.
VJ Reddy at 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
0 Sergey Alexandrovich Kryukov 229
1 OriginalGriff 140
2 Maciej Los 138
3 Sascha Lefévre 120
4 BillWoodruff 60
0 Sergey Alexandrovich Kryukov 8,771
1 OriginalGriff 6,905
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059

Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | 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