html - Type or namespace not found -
hello doing assignment , program using visual studio 2012 lab getting error in behind code in .cs file error giving me line 20 , compilation error message says
the type or namespace name 'player' not found (are missing using directive or assembly reference?).
please me
line 18: protected void addplayer(string name, int jersey, string team){ line 19: line 20: player player = new player(name, jersey); line 21: line 22: if ( string.equals(team, "team 1", stringcomparison.ordinalignorecase))
my whole code
public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void addplayer(string name, int jersey, string team){ player = new player(name, jersey); if ( string.equals(team, "team 1", stringcomparison.ordinalignorecase)) listteam1.items.add(player.getname() + "-" + player.getjersey()); else if (string.equals(team, "team 2", stringcomparison.ordinalignorecase)) listteam2.items.add(player.getname() + "-" + player.getjersey()); } protected int numplayers(string team) { if (string.equals(team, "team 1", stringcomparison.ordinalignorecase)) return listteam1.items.count; else if (string.equals(team, "team 2", stringcomparison.ordinalignorecase)) return listteam2.items.count; else return 0; } protected void buttonleft_click(object sender, eventargs e) { string addeditem = listteam2.selecteditem.text; listteam2.items.removeat(listteam2.selectedindex); listteam1.items.add(addeditem); } protected void buttonright_click(object sender, eventargs e) { string addeditem = listteam1.selecteditem.text; listteam1.items.removeat(listteam1.selectedindex); listteam2.items.add(addeditem); } protected void buttonadd_click(object sender, eventargs e) { addplayer(tbname.text, int.parse(tbjersey.text), radioteam.selecteditem.text); tbjersey.text = ""; tbname.text = ""; } }
when error, means says. doesn't know what player is, , therefore it's in namespace. need using directive imports namespace. if player in assembly, need add reference assembly.
Comments
Post a Comment