课程设计报告完整版(4)

2019-05-17 14:22

if (DateTime.Compare(shenqing, tiqing) > 0) rbyes1.Checked = true; else

rbno1.Checked = true; }

catch (Exception ex) { MessageBox.Show(\没有 if(DateTime.Compare(shenqing, tiqing) > 0) rbyes1.Checked = true; else rbno1.Checked = true; } else

{ dataGridView1.Rows[i + 1].Selected = true; 你要查询的信息!\, \查询提示\); } con.Close(); } int row;

(2) 备忘录下一条的按钮代码的实现: private void button3_Click(object sender, EventArgs e)

{ row = dataGridView1.RowCount; for (int i = 0; i < row - 1; i++)

{ if (dataGridView1.Rows[i].Selected == true) { this.dataGridView1.Rows[i].Selected =

false;

if (i == row - 2)

{dataGridView1.Rows[0].Selected = true; textBox1.Text = dataGridView1.Rows[0]. Cells[0].Value.ToString().Trim(); textBox2.Text = dataGridView1.Rows[0]. Cells[1].Value.ToString().Trim(); textBox3.Text = dataGridView1.Rows[0]. Cells[2].Value.ToString().Trim(); textBox4.Text = dataGridView1.Rows[0]. Cells[3].Value.ToString().Trim(); textBox5.Text = datalls[4].Value. ToString().Trim();

DateTime shenqing = DateTime.Parse (textBox3.Text);

DateTime tiqing = DateTime.Parse (textBox4.Text);

textBox1.Text = dataGridView1.Rows[i + 1].Cells[0].Value.ToString().Trim(); textBox2.Text = dataGridView1.Rows[i + 1].Cells[1].Value.ToString().Trim(); textBox3.Text = dataGridView1.Rows[i + 1].Cells[2].Value.ToString().Trim(); textBox4.Text = dataGridView1.Rows[i + 1].Cells[3].Value.ToString().Trim(); textBox5.Text = dataGridView1.Rows[i +

1].Cells[4].Value.ToString().Trim(); DateTime shenqing = DateTime.Parse (textBox3.Text);

DateTime tiqing = DateTime.Parse (textBox4.Text);

if (DateTime.Compare(shenqing, tiqing) > 0) rbyes1.Checked = true; else

rbno1.Checked = true;

} break; }

(3)备忘录上一条按钮代码的实现: private void button2_Click(object sender, EventArgs e)

{ row = dataGridView1.RowCount; for (int i = 0; i < row - 1; i++)

{if (dataGridView1.Rows[i].Selected == true) { this.dataGridView1.Rows[i].Selected =

false; if (i == 0)

{ dataGridView1.Rows[row-2].Selected = true; DateTime shenqing = DateTime.Parse (textBox3.Text);

DateTime tiqing = DateTime.Parse textBox1.Text = dataGridView1.Rows[row -

2].Cells[0].Value.ToString().Trim(); textBox2.Text = dataGridView1.Rows[row -

2].Cells[1].Value.ToString().Trim(); textBox3.Text = dataGridView1.Rows[row -

2].Cells[2].Value.ToString().Trim(); textBox4.Text = dataGridView1.Rows[row -

2].Cells[3].Value.ToString().Trim(); textBox5.Text = dataGridView1.Rows[row -

2].Cells[4].Value.ToString().Trim(); DateTime shenqing = DateTime.Parse (textBox3.Text);

DateTime tiqing = DateTime.Parse (textBox4.Text);

if (DateTime.Compare(shenqing, tiqing) > 0) rbyes1.Checked = true; else

rbno1.Checked = true; } else

{dataGridView1.Rows[i -1].Selected = true; textBox1.Text = dataGridView1.Rows[i - 1].Cells[0].Value.ToString().Trim(); textBox2.Text = dataGridView1.Rows[i -1].Cells[1].Value.ToString().Trim(); textBox3.Text = dataGridView1.Rows[i - 1].Cells[2].Value.ToString().Trim(); textBox4.Text = dataGridView1.Rows[i - 1].Cells[3].Value.ToString().Trim(); textBox5.Text = dataGridView1.Rows[i - 1].Cells[4].Value.ToString().Trim();

(textBox4.Text);

if (DateTime.Compare(shenqing, tiqing) > 0) rbyes1.Checked = true; else

rbno1.Checked = true;

} break; }

(4)备忘录的增加按钮的代码的实现: priva te void button7_Click(object sender, EventArgs e) {string title=null; string neirong = null;

DateTime chuang = DateTime.Now; DateTime tixing = DateTime.Now; string lei = null; if (textBox8.Text == \)

{ MessageBox.Show(\你没有输入备忘录的标题\,\错误提示\); return;

} else

if (textBox9.Text == \)

{ MessageBox.Show(\你没有输入备忘录的内容\, \错误提示\); return; } else

if (textBox10.Text == \)

{ MessageBox.Show(\你没有输入备忘录的提示时 间\, \错误提示\);

return; } else

if (comboBox2.Text == \)

{ MessageBox.Show(\你没有选择备忘录的类别\, SqlCommandBuilder scd = new SqlCommandBuilder (sda);

DataSet ds = new DataSet(); sda.Fill(ds,\);

DataRow newdr = ds.Tables[\]. \错误提示\); return; }

title = textBox8.Text; neirong = textBox9.Text; try

{ tixing = DateTime.Parse(textBox10.Text);} catch (Exception s)

{ MessageBox.Show(\你输入的日期格式不正确\, \错误提示\); return; }

lei = comboBox2.Text;

if (lei.Equals(\日程表\) == false && lei.Equals(\纪念日\) == false && lei.Equals(\记事本\) == false && lei.Equals(\节日\) == false && lei.Equals(\备忘录\) == false) { MessageBox.Show(\你输入的类别不正确,请重新输入!\, \错误提示\); return; }

string connstr = \Source=(local);Initial Catalog=Message;Integrated Security=True\; SqlConnection con = new SqlConnection (connstr); ; con.Open();

string str = \备忘录\; SqlDataAdapter sda = new SqlDataAdapter (str,con);

NewRow();

newdr[0] = title; newdr[1] = neirong; newdr[2] = chuang; newdr[3] = tixing; newdr[4] = lei;

ds.Tables[\].Rows.Add(newdr); try

{ sda.Update(ds.Tables[\]); } catch (Exception en)

{ MessageBox.Show(\备忘录已存在\);return;} MessageBox.Show(\增加用户成功!\,\提示\); textBox8.Clear(); textBox9.Clear(); textBox10.Clear(); comboBox2.Text = \; con.Close(); }

(5)备忘录的修改按钮代码的实现: private void button4_Click(object sender, EventArgs e)

{ 修改备忘录 xiu = new 修改备忘录(); xiu.Visible = true;

}

(6)实现时时提醒功能代码的实现: private void 时时提醒_Tick(object sender, EventArgs e) {

string connstr = \Source=(local);Initial Catalog=Message;Integrated Security=True\; SqlConnection con = new SqlConnection

(connstr); con.Open();

SqlCommand comm = new SqlCommand(); string str; string s; string time =

System.DateTime.Now.Year.ToString() + \ + System.DateTime.Now.Month.ToString() + \ + System.DateTime.Now.Day.ToString() + \ + System.DateTime.Now.ToLongTimeString(); str=\备忘录 where 提醒时间

='\+time+\;

comm.CommandText = str; comm.Connection = con;

SqlDataReader dr = comm.ExecuteReader(); if (dr.Read())

{ s = dr.GetValue(1).ToString().Trim(); MessageBox.Show(s,\温馨提示\); }

dr.Close(); con.Close() }

修改密码的界面的实现,如下图4-4所示:

图4-4修改密码界面的实现

(1)实现备忘录的删除按钮的代码的实现: private void button2_Click(object sender, EventArgs e)

{ string str = null;

if (textBox1.Text != \ && textBox2.Text == \ && comboBox2.Text == \)

{ str = \备忘录 where 备忘标题='\+textBox1.Text+\; textBox1.Clear(); } else

if (textBox1.Text == \ && textBox2.Text != \ && comboBox2.Text == \)

{ DateTime time = DateTime.Now; try

{time = DateTime.Parse(textBox2.Text);} catch (Exception s)

{ MessageBox.Show(\你输入的日期格式不正确\, \错误提示\); return; }

str = \from 备忘录 where 提醒时间='\ + textBox2.Text + \; textBox2.Clear(); } else

if (textBox1.Text == \ && textBox2.Text == \ else

&& comboBox2.Text!= \) { string lei = comboBox2.Text;

if (lei.Equals(\日程表\) == false &&

lei.Equals(\纪念日\) == false && lei.Equals(\记事本\) == false && lei.Equals(\节日\) == false && lei.Equals(\备忘录\) == false) { MessageBox.Show(\你输入的类别不正确,请重新输入!\, \错误提示\); return; } else

{ str = \from 备忘录 where 备忘类别='\+ comboBox2.Text + \; comboBox2.Text = null; } else

if (textBox1.Text != \ && textBox2.Text != \&& comboBox2.Text == \) { DateTime time = DateTime.Now; try

{time = DateTime.Parse(textBox2.Text);} catch (Exception s)

{ MessageBox.Show(\你输入的日期格式不正确\, \错误提示\); return; }

str = \from 备忘录 where 提醒时间='\ + textBox2.Text + \备忘标题='\ + textBox1.Text + \; textBox1.Clear(); textBox2.Clear(); }

if (textBox1.Text != \ && textBox2.Text == \ && comboBox2.Text != \) { string lei = comboBox2.Text;

if (lei.Equals(\日程表\) == false &&

lei.Equals(\纪念日\) == false && lei.Equals(\记事本\) == false && lei.Equals(\节日\) == false && lei.Equals(\备忘录\) == false)

{ MessageBox.Show(\你输入的类别不正确,请重 新输入!\, \错误提示\);return; } else

{ str = \from 备忘录 where 备忘类别='\ + comboBox2.Text + \备忘标题='\ + textBox1.Text + \; comboBox2.Text = null; textBox1.Clear(); } else

if (textBox1.Text == \ && textBox2.Text != \ && comboBox2.Text != \) { string lei = comboBox2.Text;

if (lei.Equals(\日程表\) == false && lei.Equals(\纪念日\) == false && lei.Equals(\记事本\) == false &&

lei.Equals(\节日\) == false && lei.Equals(\备忘录\) == false)

{MessageBox.Show(\你输入的类别不正确,请重新输入!\, \错误提示\); return; } else

{ DateTime time = DateTime.Now;


课程设计报告完整版(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:健十商城孕妇食品之孕妇不能吃的水果有哪些

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: