-
Re: VB Riddle, Simplified
I simplified the puzzle:
First line runs OK. The second fails.
**** Q: How is this possible? ****
' Here is complete code (there is no other code
' in the form or elsewhere)
Option Explicit
Private Sub Form_Click()
Caption = MsgBox("Hello", vbOKOnly)
Caption = MsgBox("Hehe", vbOKOnly) ' <<< ERROR!
End Sub
-
Re: VB Riddle, Simplified
Technically, I can make Caption a write-once property such as
Private mCaption As String
Public Property Let Caption(RHS As String)
If (mCaption = "") Then
mCaption = RHS
Else
' Raise an error
End If
End Property
Do I have a prize?
Don
Bruno Paris <nospam_ameba@zg.tel.hr> wrote in message
news:38e729eb@news.devx.com...
> I simplified the puzzle:
>
> First line runs OK. The second fails.
> **** Q: How is this possible? ****
>
> ' Here is complete code (there is no other code
> ' in the form or elsewhere)
> Option Explicit
>
> Private Sub Form_Click()
> Caption = MsgBox("Hello", vbOKOnly)
> Caption = MsgBox("Hehe", vbOKOnly) ' <<< ERROR!
> End Sub
>
>
>
>
>
-
Re: VB Riddle, Simplified
Hi, Don
No prize. Caption is read-write property of the form.
There is no other code in the form. There are no other modules in the
project. Also, I didn't add any reference (.DLL or .OCX) to the
project.
Bruno
Donald Xie wrote:
>Technically, I can make Caption a write-once property such as
>
>Private mCaption As String
>Public Property Let Caption(RHS As String)
> If (mCaption = "") Then
> mCaption = RHS
> Else
> ' Raise an error
> End If
>End Property
>
>Do I have a prize?
>
>Don
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|