Add User Properties to Controls

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
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS