请教请教,我要实现表中点击已结算后,给用户一个提示框,用户选择“是” 按钮后,锁定记录并勾选已结算,如下图1,然后选择“否”以后,就取消锁定与勾选,如下图2,表中能实现这功能,但记录窗口始终不能同步显示,需要点击另一条记录后,再回过去点刚刚修改的那个记录才能看到表与记录窗口都没有勾选,请问这是怎么一回事,如何才能实现这一功能呢?(图2中是点击“否”以后,表中的勾选没有了,但上面的记录窗口的勾选还存在,这样子会给用户一个错觉)
If Forms("明细录入").Opened() Then
Dim lab7 As WinForm.Label = e.Form.Controls("Label7")
Dim st As String = "" .PadLeft(1)
If user.IsRole("结算") = False Then
If e.DataRow("已结算") = True Then
e.DataRow("已结算") = False
MessageBox.Show("你无结算权限","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
End If
Else
Dim chek As WinForm.CheckBox = Forms("明细录入").Controls("CheckBox1")
If chek.Checked = False '用于批量结算时跳过重复执行下面的消息提示
Dim Result As DialogResult
If e.DataRow("已结算")=True Then
Result = MessageBox.Show("请确认是否已结算,确认后将锁定此记录不能再修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
e.DataRow.Locked = True
e.DataRow("已结算") = True
e.DataTable.Save
Else
e.Cancel = True
e.DataRow.Locked = False
e.DataRow("已结算") = False '主要是这一段代码,能改变表中状态,但不能改变记录窗口的状态
End If
End If
Dim drs As List(Of DataRow)
drs = DataTables("支出总表").Select("[已结算] = 'false' ")
If drs.Count -1 >= 0 Then
chek.Enabled =True
chek.Checked = False
End If
End If
Dim drss As List(Of DataRow)
drss = DataTables("支出总表").Select("")
If drss.Count -1 < 0 Then
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录"
Else
If DataTables("支出总表").Compute("sum(未结算金额)") = Nothing Then
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录" & st & st & "合计金额 :" & st & DataTables("支出总表").Compute("sum(金额)") & "元" & st & ",其中已结算:" & st & DataTables("支出总表").Compute("sum(已结算金额)") & "元" & st & ",未结算:" & st & "0" & st & "元"
Else
If DataTables("支出总表").Compute("sum(已结算金额)") = Nothing Then
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录" & st & st & "合计金额 :" & st & DataTables("支出总表").Compute("sum(金额)") & "元" & st & ",其中已结算:" & st & "0" & "元" & st & ",未结算:" & st & DataTables("支出总表").Compute("sum(未结算金额)") & "元"
Else
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录" & st & st & "合计金额 :" & st & DataTables("支出总表").Compute("sum(金额)") & "元" & st & ",其中已结算:" & st & DataTables("支出总表").Compute("sum(已结算金额)") & "元" & st & ",未结算:" & st & DataTables("支出总表").Compute("sum(未结算金额)") & "元"
End If
End If
End If
End If
End If