Necuno
Court Jester
- Joined
- Sep 27, 2005
- Messages
- 58,566
- Reaction score
- 3,437
Code:
private void DoSomething(int rowID, int selectedIndex)
{
if (selectedIndex != rowID)
{
[COLOR="Red"]Button btn[/COLOR] = (Button)SomeTable.Rows[selectedIndex].Cells[0].Controls[0];
//do something with button
}
[COLOR="Red"]Button btn[/COLOR] = (Button)SomeTable.Rows[rowID].Cells[0].Controls[0];
//do something with button
}
Seems that IDE don't like the Button being declared in the IF and just under it with the same name, now i thought that if a var is declared inside the IF it would be seperate instance of the button itself from declartion outside the IF.
why ?