Link to home
Start Free TrialLog in
Avatar of VooDooBamboo
VooDooBamboo

asked on

Problem with converting from ToolStripMenuItem to Button in C#

I am VERY new to C# coming from VB and having an issue.  I have some code that had some options within a toolstipmenu.  I removed these and replaced them with buttons on the form instead.  Below is the code for one of them.  I just took the code and copied it for the button but its not working.  

It dies on....
ToolStripMenuItem item = (ToolStripMenuItem)sender;

Says...
Unable to cast object of type 'System.Windows.Forms.Button' to type 'System.Windows.Forms.ToolStripMenuItem'.

I know its because there is no more toolstripmenu.  As I said I replaced the options on that with buttons.  Any ideas on what is wrong?

Thank you
private void button14_Click(object sender, EventArgs e)
        {
            CurrentSeat.Enabled = true;
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            LastSeat = (KeyValuePair<LLUUID, LLVector3>)item.Tag;
            Client.Self.RequestSit(LastSeat.Key, LastSeat.Value);
            Client.Self.Sit();
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial