Click here to Skip to main content
15,921,530 members
Home / Discussions / C#
   

C#

 
Questionhow to access a c code with c# Pin
mfmaneef3-Mar-07 23:05
mfmaneef3-Mar-07 23:05 
AnswerRe: how to access a c code with c# Pin
Vasudevan Deepak Kumar4-Mar-07 5:23
Vasudevan Deepak Kumar4-Mar-07 5:23 
GeneralRe: how to access a c code with c# Pin
mfmaneef6-Mar-07 21:05
mfmaneef6-Mar-07 21:05 
QuestionPassword Form Pin
krajah103-Mar-07 20:51
krajah103-Mar-07 20:51 
AnswerRe: Password Form Pin
Christian Graus3-Mar-07 23:33
protectorChristian Graus3-Mar-07 23:33 
QuestionTapi Pin
matata_mn3-Mar-07 19:36
matata_mn3-Mar-07 19:36 
AnswerRe: Tapi Pin
Vasudevan Deepak Kumar4-Mar-07 5:05
Vasudevan Deepak Kumar4-Mar-07 5:05 
QuestionHow to add a separator in menu? Pin
Neal Conrardy3-Mar-07 18:35
Neal Conrardy3-Mar-07 18:35 
I have been learning C# Forms from Petzold book but it only illustrates Menu and not MenuStrip. I know how to add a separator for a Menu (new MenuItem("-")but I do not know how to add a separator for a MenuStrip. Does anyone know of a reference or can someone show me how?


// Menu items.

MenuStrip menu ;

ToolStripMenuItem menuFile ;
ToolStripMenuItem menuFileOpen ;
ToolStripMenuItem menuFileSave ;
ToolStripMenuItem menuFileSaveAs;
ToolStripMenuItem menuFileExit ;
ToolStripMenuItem menuHelp ;
ToolStripMenuItem menuHelpAbout ;

.
.
.

// Menus.

menu = new MenuStrip();

menuFile = new ToolStripMenuItem("&File" );

menuFileOpen = new ToolStripMenuItem("&Open..." , null, new EventHandler(MenuFileOpenOnClick ), Keys.Control | Keys.O);
menuFileSave = new ToolStripMenuItem("&Save" , null, new EventHandler(MenuFileSaveOnClick ), Keys.Control | Keys.S);
menuFileSaveAs = new ToolStripMenuItem("Sa&ve As..." , null, new EventHandler(MenuFileSaveAsOnClick), Keys.Control | Keys.V);
menuFileExit = new ToolStripMenuItem("&Exit" , null, new EventHandler(MenuFileExitOnClick ), Keys.Control | Keys.E);

menuHelp = new ToolStripMenuItem("&Help" );
menuHelpAbout = new ToolStripMenuItem("&About" , null, new EventHandler(MenuHelpAboutOnClick ), Keys.Control | Keys.A);

// Add items to the main menu.

menu.Items.Add(menuFile);

menuFile.DropDownItems.Add(menuFileOpen );
menuFile.DropDownItems.Add(menuFileSave );
menuFile.DropDownItems.Add(menuFileSaveAs);
menuFile.DropDownItems.Add(menuFileExit );

menu.Items.Add(menuHelp);

menuHelp.DropDownItems.Add(menuHelpAbout );

// Add the list of controls.

Controls.Add(menu);

// Assign the menu to the form.

MainMenuStrip = menu;

// Disable Save and SaveAs since there is no file open.

menuFileSave .Enabled = false;
menuFileSaveAs.Enabled = false;

AnswerRe: How to add a separator in menu? Pin
Dawid Mazuruk3-Mar-07 22:14
Dawid Mazuruk3-Mar-07 22:14 
GeneralRe: How to add a separator in menu? Pin
Neal Conrardy4-Mar-07 5:41
Neal Conrardy4-Mar-07 5:41 
QuestionRe: How to add a separator in menu? Pin
Neal Conrardy4-Mar-07 14:56
Neal Conrardy4-Mar-07 14:56 
QuestionHow to Pass More than One Value from Parent to Child? Pin
Khoramdin3-Mar-07 18:17
Khoramdin3-Mar-07 18:17 
AnswerRe: How to Pass More than One Value from Parent to Child? Pin
Tamimi - Code3-Mar-07 19:39
Tamimi - Code3-Mar-07 19:39 
AnswerRe: How to Pass More than One Value from Parent to Child? Pin
khmays1233-Mar-07 19:54
khmays1233-Mar-07 19:54 
Questionvisual commonet for angle... Pin
barak1604873-Mar-07 17:20
barak1604873-Mar-07 17:20 
Questionone textbox - bind to 2 fields Pin
Glen Harvy3-Mar-07 15:18
Glen Harvy3-Mar-07 15:18 
Questionfaster way to adjust contrast????? Pin
samreengr83-Mar-07 11:21
samreengr83-Mar-07 11:21 
AnswerRe: faster way to adjust contrast????? Pin
Christian Graus3-Mar-07 23:29
protectorChristian Graus3-Mar-07 23:29 
GeneralRe: faster way to adjust contrast????? Pin
samreengr85-Mar-07 8:19
samreengr85-Mar-07 8:19 
AnswerRe: faster way to adjust contrast????? Pin
Vasudevan Deepak Kumar4-Mar-07 5:06
Vasudevan Deepak Kumar4-Mar-07 5:06 
Questionpopulating a Treeview in c# [modified] Pin
Starzfighter3-Mar-07 10:55
Starzfighter3-Mar-07 10:55 
AnswerRe: populating a Treeview in c# Pin
Abisodun3-Mar-07 12:04
Abisodun3-Mar-07 12:04 
GeneralRe: populating a Treeview in c# Pin
Starzfighter4-Mar-07 0:33
Starzfighter4-Mar-07 0:33 
GeneralRe: populating a Treeview in c# Pin
Abisodun4-Mar-07 2:21
Abisodun4-Mar-07 2:21 
Questiondynamically generate the copy of background Pin
sushantkaura3-Mar-07 9:50
sushantkaura3-Mar-07 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.