FancyPrairie
Programmer
I've created a composite control and it works fine except I don't know the syntax for when a property of the control is nothing.
I have dropped my composite control onto my form, within Visual Studio, 3 times. In the first one I leave the property equal to nothing. I assign values to the property in the 2nd and 3rd copy of the control. When I click on the 2nd or 3rd copy of the control, the property displays correctly. However, if I click on the 1st one, the property displays the value of the 3rd one rather than nothing. I believe it has to do with the line of code below (shown in red).
Since I'm assuming that that line of code is giving me the problem, does anyone know what the correct syntax should be?
If CType(ViewState("cbox"), Object) Is Nothing Then return cnnInfo
I have dropped my composite control onto my form, within Visual Studio, 3 times. In the first one I leave the property equal to nothing. I assign values to the property in the 2nd and 3rd copy of the control. When I click on the 2nd or 3rd copy of the control, the property displays correctly. However, if I click on the 1st one, the property displays the value of the 3rd one rather than nothing. I believe it has to do with the line of code below (shown in red).
Since I'm assuming that that line of code is giving me the problem, does anyone know what the correct syntax should be?
Code:
<ToolboxData("<{0}:MHS runat=server></{0}:MHS"), _
Designer(gettype(WBS.Web.UI.Design.MHSDesigner))> _
Public Class MHS
Inherits CompositeControl
Implements IValidator
Implements ICallbackEventHandler
Public Shared cnnInfo As New clsConfigureDataSource
<NotifyParentProperty(True), _
DefaultValue(""), _
Description(""), _
PersistenceMode(PersistenceMode.InnerProperty), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Content), _
DisplayName("(Configure Data Source)"), _
RefreshProperties(RefreshProperties.Repaint)> _
Public Property cbox() As clsConfigureDataSource
Get
try
Code:
Return DirectCast(ViewState("cbox"), clsConfigureDataSource)
catch ex as Exception
msgbox("(Configure Data Source):" & vbcrlf & ex.Message)
return cnnInfo
end try
End Get
Set(ByVal Value As clsConfigureDataSource)
try
ViewState("cbox") = value
cnnInfo = value
catch ex as Exception
msgbox(i & " " & "(Configure Data Source):" & vbcrlf & ex.Message & vbcrlf & me.id)
end try
End Set
End Property
Code:
<TypeConverter(GetType(clsParentProperty_ConfigureDataSource))> _
Public Class clsConfigureDataSource
Private strUDLFile as String = ""
<NotifyParentProperty(True), _
Description(""), _
DefaultValue(""), _
TypeConverter(GetType(clsUDLFiles_LookUp)), _
DisplayName("1. Data Source"), _
RefreshProperties(RefreshProperties.All)> _
Public Property DataSource() as string
Get
Return strUDLFile
End Get
Set(ByVal value As string)
strUDLFile = value
End Set
end Property