Created
January 13, 2016 06:43
-
-
Save relyky/1acd9a4f098be3092ab6 to your computer and use it in GitHub Desktop.
VB6,ListView,ItemCheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'# 限制不可勾選項目 | |
'# when 某欄位值 = “不準勾選我” then 取消勾選。 | |
Private Sub lsvData_ItemCheck(ByVal itm As MSComctlLib.ListItem) | |
Debug.Print "ON : lsvData_ItemCheck → Index " & itm.Index & "," & itm.Text & "," & itm.Checked ' tracing | |
If itm.Checked = True Then '# 若勾選項目 | |
' parse fields | |
Dim FILE_NO, IMP_RETURN_DATE, IMP_REVERSAL_DATE As String | |
FILE_NO = itm.Text | |
IMP_RETURN_DATE = itm.SubItems(14) | |
IMP_REVERSAL_DATE = itm.SubItems(15) | |
'# when 某欄位值 = “不準勾選我” then 取消勾選。 | |
If IMP_RETURN_DATE = "" Or IMP_REVERSAL_DATE = "" Then | |
'# 取消勾選 | |
itm.Checked = False | |
'alert user | |
MsgBox "此項目[" & FILE_NO & "]不可勾選。", vbOKOnly + vbExclamation, "訊息" | |
End If | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment