vvkl said:
In Form1's Load event, I want to know if a user-defined property which named
"EngineName" in existence,
how to do that ?
You could use error handling to trap the situation where the
property does not exist.
On Error GoTo ErrorHandler
strEngine = Me.EngineName
. . .
Exit Sub
ErrorHandler:
Select Case Err.Number
Case ? 'Property not there
Me.Properties.Append CreateProperty("EngineName", . . .
Resume
Case . . .
Case Else
MsgBox Err.number & " - " & Err.Description
End Select
End Sub
Alternatively, you check to see if the property is in the
form's properties collection:
Dim prp As Property
Dim PropExists As Boolean
For Each prp In Me.Properties
If prp.Name = "EngineName" Then PropExists = True
Next prp
If Not PropExists Then
Me.Properties.Append CreateProperty("EngineName", . . .
End If
strEngine = Me.EngineName