/*公用Class用于保存登录者信息*/ using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; namespace BusinessLogic { public class Sys_User { public static string sUserID ; } } /*登陆操作*/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using BusinessLogic; using System.Threading;namespace CMS { public partial class frmLogin { public frmLogin() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if(登陆成功) { tbSys_BL.sUserID =this.txtUserId.Text; } } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } } }/*使用*/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using BusinessLogic; using System.Threading; public partial class frmUser { public frmLogin() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("当前用户"+tbSys_BL.sUserID);
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace BusinessLogic
{
public class Sys_User
{
public static string sUserID ;
}
}
/*登陆操作*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BusinessLogic;
using System.Threading;namespace CMS
{
public partial class frmLogin
{ public frmLogin()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
if(登陆成功)
{
tbSys_BL.sUserID =this.txtUserId.Text;
}
} private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}/*使用*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BusinessLogic;
using System.Threading;
public partial class frmUser
{ public frmLogin()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("当前用户"+tbSys_BL.sUserID);
} private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}