一个类的属性要附值时间.datetimenow 不叫附值呢。
private void 签到ToolStripMenuItem_Click(object sender, EventArgs e){
string name = this.dgvSe.SelectedRows[0].Cells["name1"].Value.ToString();
if (recordTable.ContainsKey(name))
{
MessageBox.Show("已经签到");
}
else
{
RecordClass recordSe = new RecordClass();
recordSe.name = name;
recordSe.firstTime = DateTime.Now;
recordTable.Add(name, recordSe);
}
}
private void 签退ToolStripMenuItem_Click(object sender, EventArgs e)
{
DataGridViewRow dr = this.dgvSe.CurrentRow;
if (dr == null)
{
return;
}
string name = dr.Cells["name1"].Value.ToString();
if (recordTable.ContainsKey(name))
{
RecordClass rc = recordTable[name];
rc.secondTime = DateTime.Now();====这一行显示不可调用的system.datetime.now
MessageBox.Show("签退成功");
}
else
{
MessageBox.Show("没签到不能签退");
}
}
--------------------编程问答-------------------- rc.secondTime = DateTime.Now; --------------------编程问答-------------------- 多了个()
你试试 --------------------编程问答-------------------- 就是这样哈哈,当时做时候.了半天,。
补充:.NET技术 , C#