So, I'm trying to get it so a user inputs a number into a textbox and outputs a messagebox. But, I keep getting the error; The name 'value does not exist in the current context. Any idea"
Code:
private void btnEnter_Click(object sender, EventArgs e)
{
// Strings MessageBox's
string a, c, d, f, g, h, i, j, k, l;
// Assign Values
a = "You Got it! Heres your next clue:\nCLUE";
c = "You Got it! Heres your next clue:\nCLUE";
d = "You Got it! Heres your next clue:\nCLUE";
f = "You Got it! Heres your next clue:\nCLUE";
g = "You Got it! Heres your next clue:\nCLUE";
h = "You Got it! Heres your next clue:\nCLUE";
i = "You Got it! Heres your next clue:\nCLUE";
j = "You Got it! Heres your next clue:\nCLUE";
k = "You Got it! Heres your next clue:\nCLUE";
l = "You Got it! Heres your next clue:\nCLUE";
int userNumber = int.Parse(txtEnter.Text);
switch (value)
{
case "5849":
return MessageBox.Show(a);
break;
case "4865":
return MessageBox.Show(c);
break;
default:
break;
}
}
EDIT: Figured it out. How would I go about adding a try catch exception?