Faced the problem of declaring a constant:

Form1 asx = new Form1(); const string valid = ""; if (asx.method_two.Checked) { valid = "1234567890"; } else { valid = "ADCDEFGHIJKLMOPQRSTUVWXYZ1234567890"; } 

    1 answer 1

    So you are trying to change the constant. The constant can only be assigned once (at initialization) and then it cannot be changed. Why do you need a constant at all? Remove const and there will be no problems, especially since you have a variable rather than a constant according to the logic of things.

    PS And never again lay out the code picture.

    • Thank you very much, just a headache from night codding ( - Grape Kun
    • @GrapeKun, if the answer satisfies you, please mark it as correct by clicking on the check mark next to the answer. - ixSci