By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,480 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

Web control library VS 2005 problems after switching from design viewto source view

P: n/a
Hi all,

i already posted this in dotnet.vb.controls but i need some help, so i
cant wait...

I have written a web control library and have some problems with it.
The Library contains only two Controls: a menu bar and a menu item
class which can have sub items (from the same class and type).
It also has a designer class which should show the control in design
time.
If i put the contron in design view on the page, everything works
(changing sizes,
adding MenuItems / Submenu items) and the data can be modified by
using the
VS Controls but if i switch to source view and back, all information
about the menuitems
are lost (but they still exist in the source view).
I have tryed to debug it, but it seams that the class will be
recreated and does not get
the information about the items and subitems, the list count is 0
after switching back to
design view.
here some code:
<ToolboxData("<{0}:WebMenuBar runat=""server""></
{0}:WebMenuBar>"),
_
DisplayName("WebMenuBar"), _
ParseChildren(True, "MenuItems"), _
DefaultProperty("MenuItems"), _
Description("A menu control which acts like the menus in
applications"), _
Designer(GetType(WebMenuBarDesigner))_
Public Class WebMenuBar
Inherits CompositeControl
----snip ----
Private m_List As List(Of WebMenuBar_MenuItem)
----- the property which gets the menu list
<Category("Data"), _
Description("MenuItems collection"), _
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content),
_
PersistenceMode(PersistenceMode.InnerDefaultProper ty)_
Public ReadOnly Property MenuItems() As List(Of
WebMenuBar_MenuItem)
Get
If m_List Is Nothing Then
m_List = New List(Of WebMenuBar_MenuItem)()
End If
OutputDebugString("GET: Public ReadOnly Property
WebMenuBar::MenuItems() As List(Of WebMenuBar_MenuItem) count = " &
m_List.Count.ToString())
Return m_List
End Get
End Property
---snip-----
VisualStudio also wants me that i create 2 functions with the name of
the class as propertys,
but i dont know for what and why, what should i return there ?:
Public ReadOnly Property WebMenuBar() As WebMenuBar
Get
OutputDebugString("GET: Public ReadOnly Property
WebMenuBar() As WebMenuBar")
Return m_WebMenuBar
End Get
End Property
Public ReadOnly Property WebMenuBar_MenuItem() As
WebMenuBar_MenuItem
Get
If m_List.Count <= 0 Then
OutputDebugString("GET NEW: Private Property
WebMenuBar_MenuItem("") As WebMenuBar_MenuItem")
Return New WebMenuBar_MenuItem()
Else
OutputDebugString("GET: Private Property
WebMenuBar_MenuItem("") As WebMenuBar_MenuItem")
Return m_List(0)
End If
End Get
End Property
Does anybody can help me ?
Kind regards
Christian
Nov 29 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.