ToolTip in PropertyGrid
How do I add a tooltip to a property in a property grid
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Scott LysleRank #49 · 31K reputationPosted Jan 30, 2007, 6:30 PM EST
Normally you don't add one. The property grid will display a description attribute when the property under edit has been selected and if the description attribute has been set for the defined property. Here is a VB example but the same thing is done in C# (You did not specify a language).
With this example, if the user editing an object with this property, when 'CuName' is selected in the grid, the Description Attribute text will appear in the description area at the bottom of the property grid (sort of like a tooltip). You can create a tooltip and assign display text to it using the SetTooltip method of the tooltip; this accepts a valid Control and the text to be displayed as arguments but this does appear to work for the property grid; I would imagine that is due to the fact that the property grid uses tooltips internally to display the property information for cells in the grid that are too small to display the full text.
Browsable(True), _
BindableAttribute(False), _
DescriptionAttribute("The display name of this CU object.")> _
Public Property CuName() As String
Get
Return mCuName
End Get
Set(ByVal value As String)
mCuName = value
End Set
End Property
suman4 reputationPosted Feb 12, 2007, 5:42 PM EST
Thank You very much. Your suggestion was helpful.