/// <summary> /// 职员帐户密码修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TmChangeAccountPwd_Click(object sender, EventArgs e) { try { if (gvdtl.Rows.Count == 0) { throw new Exception("没有内容,不能查阅"); } if (gvdtl.SelectedRows.Count == 0) { throw new Exception("没有选中的行,请选中后继续."); } var account = new AccountFrm(); //获取所选中行中的帐号名称及帐号密码 account.Username = Convert.ToString(gvdtl.Rows[gvdtl.CurrentCell.RowIndex].Cells[2].Value); account.Userpwd = Convert.ToString(gvdtl.Rows[gvdtl.CurrentCell.RowIndex].Cells[1].Value); account.ShowDtl(); account.StartPosition = FormStartPosition.CenterScreen; account.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 帐号密码修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TmChange_Click(object sender, EventArgs e) { try { var account = new AccountFrm(); account.Username = GlobalClasscs.User.StrUsrName; account.Userpwd = GlobalClasscs.User.StrUsrpwd; account.ShowDtl(); account.StartPosition = FormStartPosition.CenterScreen; account.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_finance_Click(object sender, EventArgs e) { bool b = false; foreach (Form f in Application.OpenForms) { if (f.Name == "AccountFrm") { b = true; } } if (!b) { AccountFrm act = new AccountFrm(); toFront(act); } }