0

hey guys...

i need help on making an undo/redo command in my menu...

can ya help!

o yeah! plz put this stuff n the simplist terms that you can think of like (insert this code here and this there)

i just got vb standard 2003 3 days ago, and have no programming experience (except for HTML), therefore i am a NOOB!!! :p

thx!

Pat

2
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by Iron_Cross
1

In the click events of your menu items you just need to call the undo/redo methods of the RichTextBox or TextBox you have on your form....You can also check to see if it's possible to undo or redo in the popup event of your menuitem's parent

For example, if I had a menuitem called miEdit with two child menuitems called miEditUndo and miEditRedo and a RichTextBox called rtbText I'd so this:

The popup event for miEdit:

public void miEdit_Popup(object sender, System.EventArgs e)
{
    if(rtbText.CanUndo)
         miEditUndo.Enabled = true;
    else
         miEditUndo.Enabled = false;
    if(rtbText.CanRedo)
         miEditRedo.Enabled = true;
    else
         miEditRedo.Enabled = false;
}

Then for the click even of the Undo button:

public void miEditUndo_Click(object sender, System.EventArgs e)
{
     rtbText.Undo();
}

Then for the click event of the Redo MenuItem

public void miEditRedo_Click(object sender, System.EventArgs e)
{
     rtbText.Redo();
}

That's how you do it ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.