The variable is assigned but its value is not used

0

As the title says, I have a variable declared at the class level but it gives me that message but I do use it.

public partial class TextBoxUniversal : TextBox
{
    private bool Sombra;
    private bool _mTeclaPermitida = true; Mensaje de advertencia
    //private string separafecha = "/";

    private Font oldFont = null;
    private Boolean waterMarkTextEnabled = false;

   [System.Diagnostics.DebuggerStepThrough]
    protected override void WndProc(ref Message m)
    {
        const Int32 emUndo = 0xc7;// Es el mensaje Deshacer para los controles TextBox de una única línea.
        const Int32 wmClear = 0x303;
        const Int32 wmCopy = 0x301;
        const Int32 wmCut = 0x300;
        const Int32 wmPaste = 0x0302;
        const Int32 wmUndo = 0x304;// Es el mensaje Deshacer para los controles TextBox multilínea.

        switch (m.Msg)
        {
            case wmClear:
                _mTeclaPermitida = true;

                break;
            case wmCopy:
                _mTeclaPermitida = true;

                break;
            case wmCut:
                _mTeclaPermitida = true;

                break;
            case wmPaste:
                var dataObject = Clipboard.GetDataObject();
                if (dataObject != null && !(dataObject.GetDataPresent(DataFormats.Text)))
                    return;

                // Comprobamos si el contenido del portapapeles es numérico.
                if ((!(ValidateClipboardText())))
                {
                    _mTeclaPermitida = false;
                    return;
                }

                _mTeclaPermitida = true;

                break;
            case emUndo:
                _mTeclaPermitida = true;

                break;
            case wmUndo:
                _mTeclaPermitida = true;

                break;
        }

        // Procesamos los restantes mensajes
        base.WndProc(ref m);

    }

How can I correct so you do not give me that message?

    
asked by Pedro Ávila 01.08.2016 в 18:50
source

1 answer

2

Remember that you must assign a default value to the variable when you declare

private bool _mTeclaPermitida = true;

sometimes find the message in English help

Compiler Warning (level 3) CS0414

    
answered by 01.08.2016 / 18:55
source