Click here to Skip to main content
11,629,371 members (62,600 online)
Rate this: bad
good
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.

Thanks
Posted 23-May-12 7:12am
Ranopi433
Comments
VJ Reddy at 23-May-12 20:44pm
   
Thank you for response and for accepting the solution :)

1 solution

Rate this: bad
good
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
   Get
       Return New DimensionData(Me)
   End Get
End Property
as explained here
http://msdn.microsoft.com/en-us/library/system.componentmodel.designerserializationvisibilityattribute.aspx#Y1900[^]
  Permalink  
Comments
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


Advertise | Privacy | Mobile
Web04 | 2.8.150723.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