منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : كودى داتاجريدفيو وبه خطا ارجو الاصلاح
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
For i = 0 To DataGridView1.Rows.Count - 1

            For j = 2 To DataGridView1.Columns.Count - 1

                Dim m As Integer = DataGridView1.Rows(i).Cells(j).Value
                Dim a As String
                If m >= 135 Then
                    a = "ممتاز"
                    DataGridView1.Rows(i).Cells(j).Value.ToString = a
                    MsgBox(a)
                ElseIf m >= 120 Then
                    a = "جيد جدا"
                    DataGridView1.Rows(i).Cells(j).Value.ToString = a
                    'MsgBox(a)
                ElseIf m >= 105 Then
                    a = "جيد "
                    a = DataGridView1.Rows(i).Cells(j).Value.ToString
                    'MsgBox(a)
                ElseIf m >= 90 Then
                    a = "مقبول "
                    a = DataGridView1.Rows(i).Cells(j).Value.ToString
                    'MsgBox(a)
                Else
                    'm < 90 Then
                    a = "ضعيف "
                    a = DataGridView1.Rows(i).Cells(j).Value.ToString

                    'MsgBox(a)
                End If
            Next
        Next
احذف ToString
هذا تعديل للكود
PHP كود :
For 0 To DataGridView1.Rows.Count 1

            For j 
2 To DataGridView1.Columns.Count 1

                Dim m 
As Integer DataGridView1.Rows(i).Cells(j).Value
                Dim a 
As String
                If m 
>= 135 Then
                    a 
"ممتاز"
 
                   DataGridView1.Rows(i).Cells(j).Value a
                    MsgBox
(a)
 
               ElseIf m >= 120 Then
                    a 
"جيد جدا"
 
                   DataGridView1.Rows(i).Cells(j).Value a
                    
'MsgBox(a)
                ElseIf m >= 105 Then
                    a = "جيد "
                    DataGridView1.Rows(i).Cells(j).Value = a
                    '
MsgBox(a)
 
               ElseIf m >= 90 Then
                    a 
"مقبول "
 
                   DataGridView1.Rows(i).Cells(j).Value a
                    
'MsgBox(a)
                Else
                    '
90 Then
                    a 
"ضعيف "
 
                   DataGridView1.Rows(i).Cells(j).Value a

                    
'MsgBox(a)
                End If
            Next
        Next 
شكرا على الرد
والكود منطقيا شغال
لكن اعانى من مشكلة التطبيق الخلايا datagridview.rows(I).cell(j).value
تعتبر integer
والمتغير a من النوع string
كيف احل هذه المشكلة
هذا تعديل الكود يستخدم الحدث CellFormatting للداتاجريد
PHP كود :
Private Sub DataGridView1_CellFormatting(ByVal sender As ObjectByVal e As DataGridViewCellFormattingEventArgsHandles DataGridView1.CellFormatting
    If e
.ColumnIndex >= 2 Then
        Dim m 
As Integer e.Value
        If m 
>= 135 Then
            e
.Value "ممتاز"
 
       ElseIf m >= 120 Then
            e
.Value "جيد جدا"
 
       ElseIf m >= 105 Then
            e
.Value "جيد "
 
       ElseIf m >= 90 Then
            e
.Value "مقبول "
 
       Else
            e
.Value "ضعيف "
 
       End If
 
   End If
End Sub 
شكرا على المساعدة وهذا هو المطلوب

[صورة مرفقة: image.png]

ارجو كود لاضافة Header and footer and some images for PrintDocument
وشكرا مقدما
لو سمحت عاوز اعمل تحقق من البيانات ممكن الكود
التحقق من شرطين
الاول الخانات كلها بها بيانات وليست فارغة
قيمة الخلايا من العمود ٢ الى الاخير اقل من أو تساوى ١٥٠
وشكرا واعذرنى أن أثقلت عليك
اخى طالب برمجة
اريد جعل البيانات ديناميكية لاستخدامها مع اكثر من قسم