|
ผมก็ไม่รู้ว่าจะใช่ตามที่ต้องการหรือเปล่าน่ะครับ ...
- Dim blnKeyPress As Boolean() = {False, False, False, False}
- Function ValidData() As Boolean
- '// Reset
- blnKeyPress = {False, False, False, False}
- '// Initialize
- ValidData = False
- '// แถว 0, หลัก 0 (อ่านค่าตาม Index)
- If DataGridView1.Rows(0).Cells(0).Value <> "" Then
- blnKeyPress(0) = True
- End If
- '// แถว 1 หลัก 0
- If DataGridView1.Rows(1).Cells(0).Value <> "" Then
- blnKeyPress(1) = True
- End If
- '// แถว 2 หลัก 1
- If DataGridView1.Rows(2).Cells(1).Value <> "" Then
- blnKeyPress(2) = True
- End If
- '// แถว 3 หลัก 1
- If DataGridView1.Rows(3).Cells(1).Value <> "" Then
- blnKeyPress(3) = True
- End If
- '// ตรวจสอบและคืนค่า
- If blnKeyPress(0) And blnKeyPress(1) And blnKeyPress(2) And blnKeyPress(3) Then ValidData = True
- End Function
- Private Sub DataGridView1_CellEndEdit(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
- If ValidData() Then
- MsgBox("Have data in cell 1, 2, 3 and 4.")
- End If
- End Sub
คัดลอกไปที่คลิปบอร์ด
|
-
|