Why can I not use a "constant" within a switch statement within scope?
- by Clay Shannon
With this code:
public partial class Form1 : Form
{
private static readonly int TABCONTROL_BASICINFO = 0;
private static readonly int TABCONTROL_CONFIDENTIALINFO = 1;
private static readonly int TABCONTROL_ROLESANDSECURITY = 2;
private static readonly int TABCONTROL_INACTIVEINFO = 3;
. . .
int ActiveTabPage = tabControlWorker.SelectedIndex;
switch (ActiveTabPage) {
case TABCONTROL_BASICINFO:
if (currentNode == "NodeBuckingham") {
} else if (currentNode == "NodeNamath") {
} else if (currentNode == "NodeParsons") {
} else {
}
break;
...I have to replace "TABCONTROL_BASICINFO" with "0", or I get, "A constant value is
expected"
Heavens to Murgatroyd! Can't it look up and see that TABCONTROL_BASICINFO is 0?