[C#]提示The name 'finder' does not exist in the current context 帮我看看是哪里有问题,该如何改正??
c#publicvoidtiqu(){stringfinder="1234567890";}privatevoidpersGSMToolStripMenuItem_Cli...
c#
public void tiqu()
{
string finder = "1234567890";
}
private void persGSMToolStripMenuItem_Click(object sender, EventArgs e)
{
tiqu();
richTextBox1.Text = richTextBox1.Text.Replace(finder, "PersGSM");
} 展开
public void tiqu()
{
string finder = "1234567890";
}
private void persGSMToolStripMenuItem_Click(object sender, EventArgs e)
{
tiqu();
richTextBox1.Text = richTextBox1.Text.Replace(finder, "PersGSM");
} 展开
展开全部
public void tiqu()
{
string finder = "1234567890";
}
finder是一个局部变量,当这个函数执行完毕的时候,finder已经释放了,在内存中已经不存在了。
可以修改为
public string tiqu()
{
string finder = "1234567890";
return finder;
}
private void persGSMToolStripMenuItem_Click(object sender, EventArgs e)
{
string fineder = tiqu();
richTextBox1.Text = richTextBox1.Text.Replace(finder, "PersGSM");
}
{
string finder = "1234567890";
}
finder是一个局部变量,当这个函数执行完毕的时候,finder已经释放了,在内存中已经不存在了。
可以修改为
public string tiqu()
{
string finder = "1234567890";
return finder;
}
private void persGSMToolStripMenuItem_Click(object sender, EventArgs e)
{
string fineder = tiqu();
richTextBox1.Text = richTextBox1.Text.Replace(finder, "PersGSM");
}
展开全部
你这么编码,编译器不报错?
public String tiqu()
{
string finder = "1234567890";
return finder;
}
private void persGSMToolStripMenuItem_Click(object sender, EventArgs e)
{
string finder =tiqu();
richTextBox1.Text = richTextBox1.Text.Replace(finder, "PersGSM");
}
public String tiqu()
{
string finder = "1234567890";
return finder;
}
private void persGSMToolStripMenuItem_Click(object sender, EventArgs e)
{
string finder =tiqu();
richTextBox1.Text = richTextBox1.Text.Replace(finder, "PersGSM");
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询