面向对象初(下) 个人总结


1.关闭窗口提示:
if(messagebox.show("提示信息","提示信息2",messageboxbuttons.yesno)==dialogResult.yes) //判断按钮选择是yes或no

messagebox.show("删除成功");


2.窗口按钮(基本 学生管理系统 )
1.lable 标签按钮
2.button 按钮
3.menustrip 分组框
4.statusstyip 下面分组框
5.datagridview ADO.net 查询一批数值 进行显示
6.timer 时钟
7.textbox 输入框

3. 创建管理员对象以及对时间管理
bk(分组框对象).txt=datetime.now.strom; //时间
管理员问题
//登录窗口
对象 对象名 =new 对象
对象名.cid=cid;
对象名.对象=对象名;
例: frc.baba = this;
//登录进去的窗口显示值
public string cid;//显示之前
toolStripStatusLabel2.Text = cid;// 将数据传到这个大窗口来
管理员权限:
//在登录窗口写命令
string ml="select qx from id";
sqlcommand dz=new sqlcommand(ml,conn);
//调命令 dz.ex(查询一个值) 再转成int

//大窗口载入的时候
public int qx;
窗口按钮名.enabled=(可用?不可用);
窗口按钮名.visible=(可见?不可见);

4.地区按钮
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication23
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void zz()
{

SqlConnection conn = new SqlConnection("server=.;database=studentinfo;uid=sa;pwd=123");
{

try
{

conn.Open();
string ml = "select cid from id";
SqlCommand dx = new SqlCommand(ml, conn);
DataSet set = new DataSet();
SqlDataAdapter cz = new SqlDataAdapter(dx);
cz.Fill(set);
DataRowCollection row= set.Tables[0].Rows;
for (int i = 0; i < row.Count; i++)
{

string y = row[i][0].ToString(); //进行循环 对取到的值一个一个添加进去
comboBox1.Items.Add(y);

}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);

 

}
finally
{

conn.Close();

}


}

}
private void Form1_Load(object sender, EventArgs e)
{
zz();
}
}
}

 

posted @ 2015-12-09 17:37  西瓜冰镇老板  阅读(173)  评论(0编辑  收藏  举报