Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
QuestionIs the VS 2005 Webbrowser really ready for prime time? Pin
cweeks786812-May-06 3:09
cweeks786812-May-06 3:09 
AnswerRe: Is the VS 2005 Webbrowser really ready for prime time? Pin
Judah Gabriel Himango2-May-06 5:49
sponsorJudah Gabriel Himango2-May-06 5:49 
Questionhow+which controll should i use to create table+ text in one view Pin
junaidbilal2-May-06 2:32
junaidbilal2-May-06 2:32 
AnswerRe: how+which controll should i use to create table+ text in one view Pin
Graham Nimbley2-May-06 2:39
Graham Nimbley2-May-06 2:39 
GeneralRe: how+which controll should i use to create table+ text in one view Pin
junaidbilal2-May-06 3:48
junaidbilal2-May-06 3:48 
GeneralRe: how+which controll should i use to create table+ text in one view Pin
Graham Nimbley2-May-06 5:52
Graham Nimbley2-May-06 5:52 
GeneralRe: how+which controll should i use to create table+ text in one view Pin
junaidbilal2-May-06 20:39
junaidbilal2-May-06 20:39 
QuestionRemoving Context Menu Items Pin
MCSD-Gandalf2-May-06 1:47
MCSD-Gandalf2-May-06 1:47 
I have an Windows app that allows users to save "bookmarks", pages they have been, and then navigate back to them. That all works. In addition, we have restricted them to 15 bookmarks, and if they select a 16th, the first one in is popped out. I am attaching a Context Menu to a button on the toolbar.

Now they would like to be able to delete an individual bookmark. I have the code working to dynamically add the bookmarked pages, to a sub-menu item for deletes. I even have the code working to delete the item from that MeunItems collection. When I check the count of that collection, it is correct, and when I click my code to add another bookmark, the old ones appear, and the one I deleted is gone. HOWEVER, when I go through the delete code, and then click on the button, none of the entries appear. Here's the code:

Load the Menu Items, both in the Main menu and the Delete Bookmarks

private void button1_Click(object sender, System.EventArgs e)
{
for (int i = 0; i < 6; i++)
{
MenuItem myMenuItem = mainToolBar.Buttons[0].DropDownMenu.MenuItems.Add("Added Item " + i);
this.mainToolBar.Buttons[0].DropDownMenu.MenuItems[myMenuItem.Index].Click += new System.EventHandler(AnotherMenuTestMethod);
deleteBookmarkMenuItem.MenuItems.Add(myMenuItem.CloneMenu());

deleteBookmarkMenuItem.MenuItems[deleteBookmarkMenuItem.MenuItems.Count -1].Click -= new System.EventHandler(AnotherMenuTestMethod);
deleteBookmarkMenuItem.MenuItems[deleteBookmarkMenuItem.MenuItems.Count -1].Click += new System.EventHandler(DeleteMenuTestMethod);
}
}

Here I'm trying to delete a specific one (just to see how to do it)

public void DeleteMenuTestMethod(object sender, System.EventArgs e)
{
MenuItem myMenuItem = (MenuItem)sender;
deleteBookmarkMenuItem.MenuItems.RemoveAt(3);

MessageBox.Show(deleteBookmarkMenuItem.MenuItems.Count.ToString());
}

As I mentioned the count is right, but when I click on the button, NOTHING appears in the Delete Items.

<added>By the way the 'deleteBookMarkMenuItem' variable is a global one for the form.

I'm obviously missing something, anyone spot it?

THANKS!

WhiteWizard (aka Gandalf)

-- modified at 8:09 Tuesday 2nd May, 2006
AnswerRe: Removing Context Menu Items Pin
MCSD-Gandalf2-May-06 4:29
MCSD-Gandalf2-May-06 4:29 
Questiondependant #warning Pin
Rafael Fernández López2-May-06 1:36
Rafael Fernández López2-May-06 1:36 
AnswerRe: dependant #warning Pin
Josh Smith2-May-06 1:53
Josh Smith2-May-06 1:53 
GeneralRe: dependant #warning Pin
Rafael Fernández López2-May-06 2:02
Rafael Fernández López2-May-06 2:02 
GeneralRe: dependant #warning Pin
Josh Smith2-May-06 3:59
Josh Smith2-May-06 3:59 
GeneralRe: dependant #warning Pin
Rafael Fernández López2-May-06 7:30
Rafael Fernández López2-May-06 7:30 
Questionmsn style - show/hide form border Pin
g00fyman2-May-06 1:29
g00fyman2-May-06 1:29 
AnswerRe: msn style - show/hide form border Pin
stancrm2-May-06 2:13
stancrm2-May-06 2:13 
GeneralRe: msn style - show/hide form border Pin
g00fyman2-May-06 2:23
g00fyman2-May-06 2:23 
QuestionHow to bind 2 exe files in one file and Extraxt those again ? Pin
hdv2122-May-06 1:17
hdv2122-May-06 1:17 
AnswerRe: How to bind 2 exe files in one file and Extraxt those again ? Pin
Graham Nimbley2-May-06 2:31
Graham Nimbley2-May-06 2:31 
QuestionPage {PAGE} of {NUMPAGES} in Word Pin
jhaga2-May-06 0:44
professionaljhaga2-May-06 0:44 
AnswerRe: Page {PAGE} of {NUMPAGES} in Word Pin
alexey N2-May-06 0:51
alexey N2-May-06 0:51 
GeneralRe: Page {PAGE} of {NUMPAGES} in Word Pin
jhaga2-May-06 1:20
professionaljhaga2-May-06 1:20 
Questioncreate DTS dynamically using C# (urgent) Pin
AmitSumit2-May-06 0:17
AmitSumit2-May-06 0:17 
AnswerRe: create DTS dynamically using C# (urgent) Pin
J4amieC2-May-06 0:59
J4amieC2-May-06 0:59 
GeneralRe: create DTS dynamically using C# (urgent) Pin
AmitSumit2-May-06 2:00
AmitSumit2-May-06 2:00 

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.