To add user-defined properties to controls, use this code to store them in the control’s tag. You can define multiple additional properties at design or run time. You can easily retrieve the value stored:
Control.Tag = AddParam((Control.Tag), _ "tooltip", "Close this window.")Control.Tag = AddParam((Control.Tag), "user", "True")Tooltip = GetParam((Control.Tag), "tooltip")Function AddParam (Text As String, _ Param As String, Value) As StringDim Text1 As StringIf Not IsNull(GetParam(Text, Param)) Then Text1 = DelParam(Text, Param)Else Text1 = TextEnd IfIf Text1 <> "" Then Text1 = Text1 & ";"End IfAddParam = Text1 & Param & "=" & (Value)End FunctionFunction DelParam (Text As String, _ Param As String) As StringDim i As IntegerDim j As IntegerDim s1 As StringDim s2 As StringDim Text1 As StringText1 = Texti = InStr(UCase(Text), UCase(Param) & "=")If i > 0 Then If i = 1 Then s1 = "" Else s1 = Left(Text, i - 2) End If j = InStr(i, Text, ";") If j > 0 Then s2 = Mid(Text, j + 1) Else s2 = "" End If If s1 = "" Or s2 = "" Then Text1 = s1 & s2 Else Text1 = s1 & ";" & s2 End IfEnd IfDelParam = Text1End FunctionFunction GetParam (Text, Param)Dim i As IntegerDim j As IntegerDim Text1 As StringIf Len(Text) Then If Left(Text, 1) <> "'" Then Text1 = ";" & Text & ";" i = InStr(LCase(Text1), ";" _ & LCase(Param) & "=") + 1 If i > 1 Then j = InStr(i + Len(Param), Text1, ";") GetParam = Mid(Text1, i + Len(Param) + 1, _ j - i - Len(Param) - 1) Else GetParam = Null End If Else GetParam = Null End IfElse GetParam = NullEnd IfEnd Function