Menu "-" gives exception

  • Thread starter Thread starter Zanna
  • Start date Start date
Z

Zanna

Hi all!

Why sometimes if I put a MenuItem with Text = "-" it gives the
NotupportedException in the InitializeComponents when the

Me.MenuItem3.Text = "-"

is executed?

Some workaound for this?

Thanks!
 
Cut the statements from the InitialiseComponent and do them in the
constructor or OnLoad of your form.

Cheers
Daniel
 
Can you share the code you are trying? If I remember correctly, you must
assign the "-" before adding the menuitem to a menu.

Cheers
Daniel
 
Can you share the code you are trying? If I remember correctly, you must
assign the "-" before adding the menuitem to a menu.

Ah!
You didn't say that the Text = "-" must be assigned *before* the menuitem is
added to the menu :)

In this way it works: I moved the MenuItems.Add() in the
InitializeComponents() after the Text assignment.

Bye,
Thanks
 
You are right, I didn't say it in my first reply, sorry :-)
Glad it worked in the end.

Cheers
Daniel
 
Back
Top