Hakims
asked on
problem with Command1.visible property in UserControl
Dear friends,
I am having a weird problem, i hope someone can tell me where i am going wrong.
My requirements are one simple usercontrol with a command button and a property "visible" for the command button. My code for the usercontrol are as below:
__________________________ __________ __________ ___
Public Property Get showButton() As Boolean
showButton = cmdButton.Visible
End Property
Public Property Let showButton(ByVal New_showButton As Boolean)
cmdButton.Visible() = New_showButton
PropertyChanged "showButton"
End Property
Private Sub UserControl_ReadProperties (PropBag As PropertyBag)
cmdButton.Visible = PropBag.ReadProperty("show Button", False)
End Sub
Private Sub UserControl_WritePropertie s(PropBag As PropertyBag)
Call PropBag.WriteProperty("sho wButton", cmdButton.Visible, False)
End Sub
__________________________ __________ __________ _______
The code above works fine, if i have a standalone project with one form and one usercontrol but if i copy and paste this code in one of my usercontrol in the project where i am using visual sourcesafe, it gives me weird results.
In this project, if i put the usercontrol on one of the form and change the "showbutton" property, it works fine if i close and open the form but once i save the project and open it again the property is lost and it changes to false.
Its not that the project is not saved, the changes other than the property are changed.
I am tired of this error. Does anyone have idea about what i am doing wrong......
Any kind of help would be appreciated.
Thanks.
I am having a weird problem, i hope someone can tell me where i am going wrong.
My requirements are one simple usercontrol with a command button and a property "visible" for the command button. My code for the usercontrol are as below:
__________________________
Public Property Get showButton() As Boolean
showButton = cmdButton.Visible
End Property
Public Property Let showButton(ByVal New_showButton As Boolean)
cmdButton.Visible() = New_showButton
PropertyChanged "showButton"
End Property
Private Sub UserControl_ReadProperties
cmdButton.Visible = PropBag.ReadProperty("show
End Sub
Private Sub UserControl_WritePropertie
Call PropBag.WriteProperty("sho
End Sub
__________________________
The code above works fine, if i have a standalone project with one form and one usercontrol but if i copy and paste this code in one of my usercontrol in the project where i am using visual sourcesafe, it gives me weird results.
In this project, if i put the usercontrol on one of the form and change the "showbutton" property, it works fine if i close and open the form but once i save the project and open it again the property is lost and it changes to false.
Its not that the project is not saved, the changes other than the property are changed.
I am tired of this error. Does anyone have idea about what i am doing wrong......
Any kind of help would be appreciated.
Thanks.
<will look at this a bit later>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hakims:
I believe you will need to use the InitProperties Event in addition to the ReadProperties and WriteProperties events.
See the VB documentation on creating custom controls for more details.
-Dennis Borg
I believe you will need to use the InitProperties Event in addition to the ReadProperties and WriteProperties events.
See the VB documentation on creating custom controls for more details.
-Dennis Borg
ASKER
can you tell me how to use the initproperties?
How will my above code look if i add the initproperties.
Thanks
But why is the control working on standalone project and gives problem with visual sourcesafe project...Any way if you could give me the code for initproperties i would try.
How will my above code look if i add the initproperties.
Thanks
But why is the control working on standalone project and gives problem with visual sourcesafe project...Any way if you could give me the code for initproperties i would try.
Private Sub UserControl_InitProperties ()
cmdButton.Visible = False
PropertyChanged "showButton"
End Sub
cmdButton.Visible = False
PropertyChanged "showButton"
End Sub
ASKER
i am sorry but this has no effect, still the same problem.
ASKER
I found something just now.
I copied the whole of my Project on Visual sourcesafe and made a local copy.
Now this time i do not connect to visual sourcesafe and work with the local copy .. and the same code works fine.
Amazing.. why is it happening like this.
any VISUAL SOURCESAFE experts here..
Am i doing something wrong while checking in the form ... ummm i think no, because i have created other properties too in this control and they are working fine except this visible property.
Still waiting for a solution. :(
I copied the whole of my Project on Visual sourcesafe and made a local copy.
Now this time i do not connect to visual sourcesafe and work with the local copy .. and the same code works fine.
Amazing.. why is it happening like this.
any VISUAL SOURCESAFE experts here..
Am i doing something wrong while checking in the form ... ummm i think no, because i have created other properties too in this control and they are working fine except this visible property.
Still waiting for a solution. :(
ASKER
I found something just now.
I copied the whole of my Project on Visual sourcesafe and made a local copy.
Now this time i do not connect to visual sourcesafe and work with the local copy .. and the same code works fine.
Amazing.. why is it happening like this.
any VISUAL SOURCESAFE experts here..
Am i doing something wrong while checking in the form ... ummm i think no, because i have created other properties too in this control and they are working fine except this visible property.
Still waiting for a solution. :(
I copied the whole of my Project on Visual sourcesafe and made a local copy.
Now this time i do not connect to visual sourcesafe and work with the local copy .. and the same code works fine.
Amazing.. why is it happening like this.
any VISUAL SOURCESAFE experts here..
Am i doing something wrong while checking in the form ... ummm i think no, because i have created other properties too in this control and they are working fine except this visible property.
Still waiting for a solution. :(
It might be that an earlier version of the control is in Visual SourceSafe. When you then create a new one, and not update the control in sourcesafe, it might give you that effect since it will try to use that one. This only goes when you are also using the visual component manager.
regards,
CJ
regards,
CJ
ASKER
I am adding this property in an existing control and i am doing the check in also properly.
Hi Hakims,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept CJ_S's comment(s) as an answer.
Hakims, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept CJ_S's comment(s) as an answer.
Hakims, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer
Computer101
E-E Moderator
Computer101
E-E Moderator