发挥你技术的发 2014年02月09日
关于两个窗体之间的问题,很麻烦,帮个忙
在主操作界面,用户想看自己刚才添加到数据库中于数据库中重复的数据,我把重复的信息在添加的过程中已经放到了了一个静态的list集合中了,用户想看这些信息的话,必须重新登录一次,当登录成功的时候,会提示“登录成功”,有“确定”和“取消”两个按钮,当用户点击确定按钮后,登录界面关闭,主界面就立刻用gridview显示重复的数据,问题是,登录界面关闭了,显示数据的这个方法运行了,但,主界面没反应。

主操作的后台代码:
if (lit != null && lit.Count > 0)
{
SJ.Common.U.safeOffdenderPhonelist = lit;

if (MessageBox.Show("警报,请重新登录查看信息", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK)
{


SJ.Common.U.id = 1;
Login l = new Login();


if (l.ShowDialog() ==false)
{
#region
Thjl.Visibility = System.Windows.Visibility.Collapsed;
Siminfo.Visibility = System.Windows.Visibility.Collapsed;
Phoneinfo.Visibility = System.Windows.Visibility.Collapsed;
In.Visibility = System.Windows.Visibility.Collapsed;
XYinfo.Visibility = System.Windows.Visibility.Collapsed;
Xinfo.Visibility = System.Windows.Visibility.Collapsed;
Zinfo.Visibility = System.Windows.Visibility.Collapsed;
Pinfo.Visibility = System.Windows.Visibility.Collapsed;
UserInfo.Visibility = System.Windows.Visibility.Visible;

TreeviewShow.Visibility = System.Windows.Visibility.Collapsed;
OutInfo.Visibility = System.Windows.Visibility.Collapsed;
#endregion


Tbl_User u = bu.GetAllInfo(U.UserName);
this.gjh.Text = u.Chuserid;
this.gname.Text = u.Ncusername;

if (u.Isex == 1)
{
boy.IsChecked = true;
girl.IsChecked = false;

}
else
{
boy.IsChecked = false;
girl.IsChecked = true;
}
this.gbirth.Text = u.Dtbirthday.ToString();
this.gjion.Text = u.Dtjoinin.ToString();





}
else
{
MessageBox.Show("恩恩");
}



}


登录界面的代码:
if (SJ.Common.U.id == 1)
{


if (ub.UserPwdByUserName(UserName.Text.Trim().ToLower()) == null)
{

MessageBox.Show("没有此用户名");
return;
}
else
{

string pwd = ub.UserPwdByUserName(UserName.Text.Trim().ToLower()).Chpassword;
if (string.IsNullOrEmpty(pwd))
{
MessageBox.Show("无此用户");
return;
}
if (pwd.ToLower() == this.Pwd.Password.Trim().ToLower())
{
U.UserName = UserName.Text.Trim().ToLower();
DataTable bt = bu.SearchCeeIsNull(UserName.Text.Trim());

if (MessageBox.Show("登录成功!") == MessageBoxResult.OK)
{
if (bt.Rows.Count > 0)
{
List<string> temp = new List<string>();
foreach (DataRow row in bt.Rows)
{
string name = row[3].ToString();


temp.Add(name);
SJ.Common.U.list = temp;

}

}


}
this.Close();
}

else
{
MessageBox.Show("失败");
}
}

}
...全文
124 点赞 收藏 9
写回复
9 条回复

还没有回复,快来抢沙发~

发动态
发帖子
C#
创建于2007-09-28

8.4w+

社区成员

64.0w+

社区内容

.NET技术 C#
社区公告
暂无公告