13-09-19, 02:04 AM
اخي محمد حتى لايبق بنفسك منها شيئ
عدل الكود الى هذا الكود
كود :
Private Sub Dgv_Table_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dgv_Table.SelectionChanged
Txt_ExpItems.Text = ""
If Dgv_Table.CurrentRow.Cells("Item_Exp").Value < Datnow Then
Txt_ExpItems.Text = "انتهت صلاحية هذه المادة"
Txt_ExpItems.BackColor = Color.Red
ElseIf Dgv_Table.CurrentRow.Cells("Item_Exp").Value = Datnow Then
Txt_ExpItems.Text = "اليوم تنتهي صلاحية هذه المادة"
Txt_ExpItems.BackColor = Color.Yellow
ElseIf Dgv_Table.CurrentRow.Cells("Item_Exp").Value = Datnow.AddDays(1) Then
Txt_ExpItems.Text = "باقي يوم على انتهاء الصلاحية"
Txt_ExpItems.BackColor = Color.Gold
ElseIf Dgv_Table.CurrentRow.Cells("Item_Exp").Value = Datnow.AddDays(2) Then
Txt_ExpItems.Text = "باقي يومان على انتهاء الصلاحية"
Txt_ExpItems.BackColor = Color.Gold
ElseIf Dgv_Table.CurrentRow.Cells("Item_Exp").Value = Datnow.AddDays(3) Then
Txt_ExpItems.Text = "باقي 3 ايام على انتهاء الصلاحية"
Txt_ExpItems.BackColor = Color.Gold
Else
Dim Firstdate As Date = Now
Dim Seconddate As Date = CDate(Dgv_Table.CurrentRow.Cells("Item_Exp").Value)
Dim kk As String = DateDiff(DateInterval.Day, Seconddate, Firstdate)
Txt_ExpItems.Text = " باقي على صلاحية هذه المادة" & (kk * -1) & "يوم"
Txt_ExpItems.BackColor = Color.Green
End If
End Subاعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات
