14-11-16, 05:47 AM
فى حقل فى الجدول يعتبر حقل مفتاح رئيسى من النوع String عاوز اقدر اغير فى البيانات .......بس لو CELL تركت فارغة او تكرر المحتوى بداخلها تظهر رسالة معينة .....و يتم الرجوع للقيمة السابقة
(14-11-16, 08:54 AM)Genius Live كتب : [ -> ]ارجوا توضيح ما المقصود بــ حقل مميز ؟
وما هي القيمة السابقة ؟
If datagridview1.CurrentRow.Cells(0).Value= Nothing MsgBox("empty cell")(14-11-16, 11:35 AM)Genius Live كتب : [ -> ]احب ان اشكرك على تعبك معىTry itChange Cells(0) to cell indexكود :
If datagridview1.CurrentRow.Cells(0).Value= Nothing MsgBox("empty cell")
If IsDBNull(DataGridView.CurrentRow.Cells("Cell").Value) Then
MsgBox("لا يمكن ان تكون القيمة فارغة", MsgBoxStyle.MsgBoxRtlReading + MsgBoxStyle.Exclamation, "تنبيه")
e.Cancel = True
End If
Private Sub DataGridView1_DataError(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError
If (e.Context = DataGridViewDataErrorContexts.Commit) _
Then
MessageBox.Show("Commit error")
End If
If (e.Context = DataGridViewDataErrorContexts _
.CurrentCellChange) Then
MessageBox.Show("Cell change")
End If
If (e.Context = DataGridViewDataErrorContexts.Parsing) _
Then
MessageBox.Show("parsing error")
End If
If (e.Context = _
DataGridViewDataErrorContexts.LeaveControl) Then
MessageBox.Show("leave control error")
End If
If (TypeOf (e.Exception) Is ConstraintException) Then
Dim view As DataGridView = CType(sender, DataGridView)
view.Rows(e.RowIndex).ErrorText = "an error"
view.Rows(e.RowIndex).Cells(e.ColumnIndex) _
.ErrorText = "an error"
e.ThrowException = False
End If
End Sub