System.Windows.Forms.Control.IsMnemonic C# (CSharp) Method

IsMnemonic() public static method

public static IsMnemonic ( char charCode, string text ) : bool
charCode char
text string
return bool
		public static bool IsMnemonic(char charCode, string text) {
			int amp;

			amp = text.IndexOf('&');

			if (amp != -1) {
				if (amp + 1 < text.Length) {
					if (text[amp + 1] != '&') {
						if (Char.ToUpper(charCode) == Char.ToUpper(text.ToCharArray(amp + 1, 1)[0])) {
							return true;
						}	
					}
				}
			}
			return false;
		}
		#endregion

Usage Example

Example #1
0
        protected internal override bool ProcessMnemonic(char charCode)
        {
            if ((!this.UseMnemonic || !Control.IsMnemonic(charCode, this.Text)) || !this.CanProcessMnemonic())
            {
                return(false);
            }
            Control parentInternal = this.ParentInternal;

            if (parentInternal != null)
            {
                System.Windows.Forms.IntSecurity.ModifyFocus.Assert();
                try
                {
                    if (parentInternal.SelectNextControl(this, true, false, true, false) && !parentInternal.ContainsFocus)
                    {
                        parentInternal.Focus();
                    }
                }
                finally
                {
                    CodeAccessPermission.RevertAssert();
                }
            }
            return(true);
        }
All Usage Examples Of System.Windows.Forms.Control::IsMnemonic
Control