ToolStripItemCollection.Add Method

Definition

Adds a ToolStripItem to the collection.

Overloads

Add(Image)

Adds a ToolStripItem that displays the specified image to the collection.

Add(String)

Adds a ToolStripItem that displays the specified text to the collection.

Add(ToolStripItem)

Adds the specified item to the end of the collection.

Add(String, Image)

Adds a ToolStripItem that displays the specified image and text to the collection.

Add(String, Image, EventHandler)

Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.

Add(Image)

Adds a ToolStripItem that displays the specified image to the collection.

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::Drawing::Image ^ image);
public System.Windows.Forms.ToolStripItem Add (System.Drawing.Image image);
public System.Windows.Forms.ToolStripItem Add (System.Drawing.Image? image);
member this.Add : System.Drawing.Image -> System.Windows.Forms.ToolStripItem
Public Function Add (image As Image) As ToolStripItem

Parameters

image
Image

The Image to be displayed on the ToolStripItem.

Returns

The new ToolStripItem.

Applies to

Add(String)

Adds a ToolStripItem that displays the specified text to the collection.

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::String ^ text);
public System.Windows.Forms.ToolStripItem Add (string text);
public System.Windows.Forms.ToolStripItem Add (string? text);
member this.Add : string -> System.Windows.Forms.ToolStripItem
Public Function Add (text As String) As ToolStripItem

Parameters

text
String

The text to be displayed on the ToolStripItem.

Returns

The new ToolStripItem.

Applies to

Add(ToolStripItem)

Adds the specified item to the end of the collection.

public:
 int Add(System::Windows::Forms::ToolStripItem ^ value);
public int Add (System.Windows.Forms.ToolStripItem value);
member this.Add : System.Windows.Forms.ToolStripItem -> int
Public Function Add (value As ToolStripItem) As Integer

Parameters

value
ToolStripItem

The ToolStripItem to add to the end of the collection.

Returns

An Int32 representing the zero-based index of the new item in the collection.

Exceptions

The value parameter is null.

Applies to

Add(String, Image)

Adds a ToolStripItem that displays the specified image and text to the collection.

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::String ^ text, System::Drawing::Image ^ image);
public System.Windows.Forms.ToolStripItem Add (string text, System.Drawing.Image image);
public System.Windows.Forms.ToolStripItem Add (string? text, System.Drawing.Image? image);
member this.Add : string * System.Drawing.Image -> System.Windows.Forms.ToolStripItem
Public Function Add (text As String, image As Image) As ToolStripItem

Parameters

text
String

The text to be displayed on the ToolStripItem.

image
Image

The Image to be displayed on the ToolStripItem.

Returns

The new ToolStripItem.

Applies to

Add(String, Image, EventHandler)

Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::String ^ text, System::Drawing::Image ^ image, EventHandler ^ onClick);
public System.Windows.Forms.ToolStripItem Add (string text, System.Drawing.Image image, EventHandler onClick);
public System.Windows.Forms.ToolStripItem Add (string? text, System.Drawing.Image? image, EventHandler? onClick);
member this.Add : string * System.Drawing.Image * EventHandler -> System.Windows.Forms.ToolStripItem
Public Function Add (text As String, image As Image, onClick As EventHandler) As ToolStripItem

Parameters

text
String

The text to be displayed on the ToolStripItem.

image
Image

The Image to be displayed on the ToolStripItem.

onClick
EventHandler

Raises the Click event.

Returns

The new ToolStripItem.

Applies to