Priyanka
Priyanka

Reputation: 2832

contextmenustrip - add menu item at runtime

I've added contextmenustrip control at the time of designing of my application. And i want to edit that contxt menu at run time. And i want to add another menu & submenu on that context menu. And i want to add handler function for that runtime created menus. Whether is it possible? If possible then provide some documentation.

thanks.

Upvotes: 0

Views: 500

Answers (1)

Priyanka
Priyanka

Reputation: 2832

I got an answer of my issue. the sample code used for solving this issue is as follows-

ToolStripMenuItem addContactToGroup = new ToolStripMenuItem();
addContactToGroup.Name = "addContactToGroupToolStripMenuItem";
addContactToGroup.Text = "Add Contact To Group";
addContactToGroup.Click += new System.EventHandler(addContactToGroup_Click);
this.contextMenuStripXtraGrid.Items.AddRange(new ToolStripItem[] { addContactToGroup });
gridControl1.ContextMenuStrip = this.contextMenuStripXtraGrid;

here this means form where contextmenustrip control is inserted.

Upvotes: 1

Related Questions