调试的时候提示,其他信息:未将对象引用设置到对象的实例。
privatevoidbtnok_Click(objectsender,EventArgse){stringname=string.Empty;stringtime=st...
private void btnok_Click(object sender, EventArgs e)
{
string name = string.Empty;
string time = string.Empty;
string add = string.Empty;
if (txtname.Text.Trim() == string.Empty)
{
MessageBox.Show("请输入姓名!","提示");
return;
}
else
{
name = txtname.Text.Trim();
}
if (cbtime.SelectedIndex == 0)
{
MessageBox.Show("请选择正确的日期", "提示");
return;
}
else
{
time = cbtime.SelectedItem.ToString();
}
if (cbadd.SelectedIndex == 0)
{
MessageBox.Show("请输入正确的地址","提示!",MessageBoxButtons.YesNo,MessageBoxIcon.Stop);
return;
}
else
{
add = cbadd.SelectedItem.ToString();
}
} 展开
{
string name = string.Empty;
string time = string.Empty;
string add = string.Empty;
if (txtname.Text.Trim() == string.Empty)
{
MessageBox.Show("请输入姓名!","提示");
return;
}
else
{
name = txtname.Text.Trim();
}
if (cbtime.SelectedIndex == 0)
{
MessageBox.Show("请选择正确的日期", "提示");
return;
}
else
{
time = cbtime.SelectedItem.ToString();
}
if (cbadd.SelectedIndex == 0)
{
MessageBox.Show("请输入正确的地址","提示!",MessageBoxButtons.YesNo,MessageBoxIcon.Stop);
return;
}
else
{
add = cbadd.SelectedItem.ToString();
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询