c# - that name does not exist in current context -
c# - that name does not exist in current context -
in case 3:
wrote mutteer(ba, bb, bc, bd, be);
seems give error (the name ba not exist in current context). gives same error bb
bc
bd
, be
.
what did wrong?
i removed of unnecessary code:
static void menu() { int loop = 4; console.writeline(" 3 mutteer voorraad"); while (loop > 2) { var ans = console.readline(); mp3(); int selection = 0; if (int.tryparse(ans, out choice)) { switch (choice) { case 3: console.writeline("mutteer voorraad."); mutteer(ba, bb, bc, bd, be); break; default: console.writeline("wrong selection!!!"); thread.sleep(1800); console.clear(); goto top; } } else { console.writeline("you must type numeric value only!!!"); thread.sleep(1800); console.clear(); goto top; } } } static void mp3() { int ba = 500; int bb = 500; int bc = 500; int bd = 500; int = 500; mp3players mp1 = new mp3players(); mp1.id = 1; mp1.vr = ba; } static void mutteer(int ba, int bb, int bc, int bd, int be) { int = 1; int a; startloop: while (i == 1) { console.writeline("wat het id van de mp3 speler?"); seek { = convert.toint16(console.readline()); } grab { console.writeline("dat geen nummer waarde!"); goto startloop; } if (a == 1) { console.writeline("wat het nieuwe voorraad"); seek { = 2; ba = convert.toint32(console.readline()); } grab { console.writeline("dat geen nummer waarde!"); goto startloop; } } }
you need move declarations of ba
, other variables global scope. code written, they're accessible in scope of mp3
method. should have:
static int ba = 500; static int bb = 500; static int bc = 500; static int bd = 500; static int = 500; static void mp3() { mp3players mp1 = new mp3players(); mp1.id = 1; mp1.vr = ba; }
c# scope
Comments
Post a Comment