Click here to Skip to main content
15,891,473 members
Home / Discussions / C#
   

C#

 
AnswerRe: Error while Calling WebService Pin
Paddy Boyd2-May-06 4:47
Paddy Boyd2-May-06 4:47 
GeneralRe: Error while Calling WebService Pin
Jax_qqq2-May-06 18:05
Jax_qqq2-May-06 18:05 
Questionwindows based application querry ! Pin
meer_Lx2-May-06 3:37
meer_Lx2-May-06 3:37 
AnswerRe: windows based application querry ! Pin
Paddy Boyd2-May-06 4:45
Paddy Boyd2-May-06 4:45 
GeneralRe: windows based application querry ! Pin
meer_Lx2-May-06 19:13
meer_Lx2-May-06 19:13 
Questionoptimize drawing operations Pin
Sasuko2-May-06 3:19
Sasuko2-May-06 3:19 
AnswerRe: optimize drawing operations Pin
J4amieC2-May-06 3:35
J4amieC2-May-06 3:35 
GeneralRe: optimize drawing operations Pin
Sasuko2-May-06 7:25
Sasuko2-May-06 7:25 
GeneralRe: optimize drawing operations Pin
J4amieC2-May-06 7:44
J4amieC2-May-06 7:44 
GeneralRe: optimize drawing operations Pin
Susuko2-May-06 9:25
Susuko2-May-06 9:25 
QuestionWindow Form - menu,height/width? Pin
george ivanov2-May-06 3:18
george ivanov2-May-06 3:18 
AnswerRe: Window Form - menu,height/width? Pin
J4amieC2-May-06 3:32
J4amieC2-May-06 3:32 
AnswerRe: Window Form - menu,height/width? Pin
Larantz2-May-06 4:54
Larantz2-May-06 4:54 
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 

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.