2016-12-11 1 views
-1

나는 모든 웹을 통해이 같은 코드를 발견하고하지만 나를 위해 작동하지 않는 것에 사용자 컨트롤에 속성을 추가 명령 단추와 내가 붙어있는 유일한 부분은 컨트롤에 대한 캡션을 얻는 것입니다. 나는 'Text'를 보여줄 속성을 가지고 있는데, 그 안에 타이프를 입력하면 캡션을 설정하지만, 프로그램을 실행하면 캡션이 지워집니다! 내가하고있는 코드에 어떤 문제가 있습니까?</p> <pre><code>Private FText As String Public Property Get Text() As String Text = FText lblText.Caption = Text End Property Public Property Let Text(ByVal Value As String) FText = Value End Property </code></pre> <p>좀 더 내가 뭐하는 거지, 난을 만드는 오전을 설명하자, VB6

답변

1

해결했습니다.

Const m_def_Caption = "Cmd" 

'Dim m_Picture As Picture 
Dim m_Caption As String 

Private Sub UserControl_InitProperties() 
    m_Caption = m_def_Caption 
End Sub 

Private Sub UserControl_ReadProperties(PropBag As PropertyBag) 
    m_Caption = PropBag.ReadProperty("Caption", m_def_Caption) 
    lblText.Caption = m_Caption 
End Sub 

Private Sub UserControl_WriteProperties(PropBag As PropertyBag) 
    Call PropBag.WriteProperty("Caption", m_Caption, m_def_Caption) 
End Sub 

Public Property Get Caption() As String 
    Caption = m_Caption 
End Property 

Public Property Let Caption(ByVal New_Caption As String) 
    m_Caption = New_Caption 
    PropertyChanged "Caption" 
End Property 

귀하의 도움에 감사 드리며,이 문제를 직접 해결할 수있어서 기쁩니다.

관련 문제