Version

GetToolThatContainsControl Method

Returns the instance of the ControlContainerTool or PopupControlContainerTool that contains the control.
Syntax
'Declaration
 
Public Function GetToolThatContainsControl( _
   ByVal containedControl As Control _
) As ToolBase
public ToolBase GetToolThatContainsControl( 
   Control containedControl
)

Parameters

containedControl
The control that is contained.

Return Value

The containing tool.
Example
The following code demonstrates how to get the ControlContainerTool that contains a particular tool.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars

	Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click

		' Get the control container tool that contains a particular control.
		Dim containerTool As ToolBase = Me.UltraToolbarsManager1.GetToolThatContainsControl(Me.Controls(0))

		If containerTool Is Nothing Then
			Debug.WriteLine("No tool contains control '" + Me.Controls(0).Name + "'.")
		Else
			Debug.WriteLine("The tool with key '" + containerTool.Key + "' contains control '" + Me.Controls(0).Name + "'.")
		End If

	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

		private void button15_Click(object sender, System.EventArgs e)
		{

			// Get the control container tool that contains a particular control.
			ToolBase containerTool = this.ultraToolbarsManager1.GetToolThatContainsControl(this.Controls[0]);
			if (containerTool == null)
				Debug.WriteLine("No tool contains control '" + this.Controls[0].Name + "'.");
			else
				Debug.WriteLine("The tool with key '" + containerTool.Key + "' contains control '" + this.Controls[0].Name + "'.");

		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also