定义几个私有变量:
private operation oper = new operation();
private string lc_yhmm; //用户密码
private string lc_cdbms; //菜单项与分隔符组成的字符串
private string lc_yhxms; //用户姓名
private string lc_jsbms; //角色编码
private string lc_jsmcs; //角色名称
private string lc_dwmcs; //单位名称
单击按钮事件中有关用户登陆代码:
private void button1_Click(object sender, EventArgs e)
{
string lc_srmm = textBox2.Text;
string lc_scmm = oper.mmjmsc(lc_srmm); //调用密码加密输出方法
if (lc_yhmm == lc_scmm)
{
FormZct.lc_cdbms = lc_cdbms; //为主窗体全局变量赋值
FormZct.lc_yhbms = textBox1.Text;
FormZct.lc_yhxms = lc_yhxms;
FormZct.lc_jsmcs = lc_jsmcs;
FormZct.lc_dwmcs = lc_dwmcs;
FormZct.lc_yhmms = lc_yhmm;
}
else
{
MessageBox.Show("用户密码输入错误 !", "系统提示",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
FormZct.lc_cdbms = string.Empty;
FormZct.lc_yhbms = string.Empty;
textBox2.Text = string.Empty;
textBox2.Focus();
return;
}
|