Hello,
I am adding a menu with 2 language option:
English
French
and want user to be able to check only one. In Visual Basic .NET is was easy and I could see the Menu property and then Select both English and French menu item and then RadioCheck was selected. Where is the RadioCheck in Visual Studio 2005
Thanks

Menu checkstate and radiocheck
Batikit
thank you everyone for the response
I do not want the code. I want to know where I can click and do it. I have a tutorial for visutal basic .NET and it has the feature. I am using Visual Studio 2005 and could not find that option to click.
Thanks in advace
afitoine
If you are using a MenuStrip for this you will have to implement your own RadioCheck like functionality… by creating a class that inherits from ToolStripMenuItem, ToolStripButton or ToolStripControlHost.
If on the other hand you are using a standard MainMenu that contains MenuItems, you will find your RadioCheck property as part of the MenuItem class.
GP_S
Ahh... in order to use the built in menu with the RadioCheck property you've got to use the MenuItem class that is generally used with the MainMenu class... both of which have been replaced with (arguably) more functional version in the 2.0 Framework and are not automatically visible in the toolbox... so to add it there you must right click within the toolbox and select Choose Items. Next, scroll down to the class named MainMenu and check its box and hit OK.
With that you should have the MainMenu class visible in your toolbox and able to be added to the form like any other control.
I should mention though that while MenuItem does expose the RadioCheck option, it is purely a visual thing and does not do the automatic un-checking of other items as you were looking for.
Mateusz Rajca
To follow up on my previous comment, below you will find a class that inherits from ToolStripMenuItem and should accomplish what you are looking for.
private class RadioToolStripMenuItem : ToolStripMenuItem
{
private bool radioCheck = true;
[DefaultValue(true)]
public bool RadioCheck
{
get { return radioCheck; }
set { radioCheck = value; }
}
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
this.Checked = true;
//Itterate through other items and uncheck any applicable items
foreach (ToolStripItem i in this.Parent.Items)
{
//We don't need to check ourselves
if (i == this)
continue;
RadioToolStripMenuItem item = i as RadioToolStripMenuItem;
//If item isn't a RadioToolStripMenuItem, move on to next item
if( item == null )
continue;
if (item.radioCheck == true)
{
//Uncheck item if it is a RadioToolStripMenuItem
item.Checked = false;
}
}
}
}