void InitUser() { Task.Run(() => { DataTable dt = T_Sysset.GetUser(); if (dt == null || dt.Rows.Count <= 0) { this.BeginInvoke(new Action(() => { lbinfo.Visible = true; lbinfo.Refresh(); })); return; } foreach (DataRow dr in dt.Rows) { string strUser = dr["UserName"].ToString(); int uid = Convert.ToInt32(dr["id"].ToString()); string usersys = dr["UserSys"].ToString(); string Uothersys = dr["OtherSys"].ToString(); string usermenu = dr["Usermenu"].ToString(); this.txtUser.BeginInvoke(new Action(() => { this.txtUser.Items.Add(strUser); })); ClsSetInfopar.lUserName.Add(strUser); ClsSetInfopar.lUserid.Add(uid); ClsSetInfopar.lUserSys.Add(usersys); ClsSetInfopar.lUserOtherSys.Add(Uothersys); ClsSetInfopar.lUsermenu.Add(usermenu); } txtUser.BeginInvoke(new Action(() => { txtUser.Focus(); })); }); }