Is it possible to bind datatable to the ToolStripMenuItem?
I'm using ContextMenuStrip & i created the submenus under ContextMenuStrip at runtime. By adding object of ToolStripMenuItem class.开发者_StackOverflow I'm having one datatable from that table i want to populate my submenus by using id & name field from my datatable for my further processing of application.
Is it possible?
thanks.
Try something like this:
foreach (DataRow dr in dataTable.Rows) {
cms.Items.Add(new ToolStripMenuItem() {
Text = dr["Name"].ToString()
});
}
精彩评论