我需要访问另一个函数中的变量。要访问的变量和访问函数是相同的类,相同的项目但功能不同。此外,没有全局变量声明访问其范围之外的变量值
protected void gdDisplay_SelectedIndexChanged(object sender, EventArgs e)
{
int dbCompany = Convert.ToInt32(gdDisplay.SelectedRow.Cells[2].Text);
}
void gvFunction_Update()
{
//place to access dbcompany variable//
}
你不能,但如果你解释为什么你需要这个,我们可能能够找到解决方法 – Domysee
你不能像那样访问它们。你想要达到什么目的? – Shetty