请大家帮我解决一个小问题...
private void Form1_Load(object sender, EventArgs e)
{
double m_dBaseMoneyGive = 0.0;
double m_dBaseMoneyLeave = 0.0;
double m_dMoneyInterestGive = 0.0;
double m_dTotalMoneyGive = 0.0;
double m_dYearInterestRate = 0.0;
double m_dMonthMoneyGive = 0.0;
int m_nMonthNum = 0;
int m_nMoneyGiveType = 0;
long m_lTotalMoney = 0;
}
.......
private void button1_Click(object sender, EventArgs e)
{
// 贷款总数Check
if (m_lTotalMoney <= 0)
//vs2005说:
//The name 'm_lTotalMoney 'does not exist in the current context
{
MessageBox.Show( "[贷款总数]输入不正确 ");
}
// 年利率Check
if (comboBox1.Text.Length==0 )
{
MessageBox.Show( "请输[年利率] ");
}
}
请帮我解决一下这是个什么问题,谢谢了
------解决方案--------------------变量m_lTotalMoney 只在load函数中起作用,要作为全局变量,而且从你写的代码来看,m_lTotalMoney 始终等于0
------解决方案--------------------//在类里面定义