public Records(Form LoginForm = null) { this.LoginForm = LoginForm; InitializeComponent(); FM = new MyWinForm(this); FM.SetDefaultStyle("纪念簿"); if (LoginForm == null) { button5.Enabled = false; } M = MyModel.GetInstance(Global.con); LB = new MyListBox(listBox2, "select * from Anniversaries order by MonthN,DayN,ID", "Title", "ID", Global.con, true); table = LB.DataTable; ToAdd(); if (M.CountAnniRecords() != 0)//有数据 { row = M.GetAnnInfoByID(M.GetNearestDateID()).Rows[0]; LB.SelectedValue = row["ID"]; label2.Text = "最近的纪念日:"; label4.Text = row["Title"] + "," + row["MonthN"] + "月" + row["DayN"] + "日。"; } }