منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[كود] طلب تعديل كود - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [كود] طلب تعديل كود (/showthread.php?tid=39131)



طلب تعديل كود - إليسار - 25-07-21

مرحبا
ممكن احد يعدل لي ع هذا الكود الفكره اذاكانت البيانات في DataGridView1 = DataGridView2 يظهر لي اوك بس هنا المشكله ع طول يظهر لي كلمة ok
المشكله الثانية لا ينقل لي البيانات المختلفة لDataGridView3 ينقل لي البيانات المتشابه بس ويكررها 






كود :
       For Each r1 As DataGridViewRow In DataGridView1.Rows
           For Each r2 As DataGridViewRow In DataGridView2.Rows
               If r1.Cells(0).Value = r2.Cells(0).Value Then
                   MsgBox("ok")

                   For indx As Integer = 2 To 5

                       Dim val1 As Double = r1.Cells(indx).Value
                       Dim val2 As Double = r2.Cells(indx).Value

                       If r1.Cells(0).Value <> r2.Cells(0).Value Then
                           Form3.DataGridView3.Rows.Add(r1.Cells(0).Value, r1.Cells(1).Value,
r1.Cells(2).Value, r1.Cells(3).Value, r1.Cells(4).Value, r1.Cells(5).Value)  
                       Else
                           Form3.DataGridView3.Rows.Add(r2.Cells(0).Value, r2.Cells(1).Value, r2.Cells(2).Value, r2.Cells(3).Value,
r2.Cells(4).Value, r2.Cells(5).Value)
                           Form3.Show()
For i = 0 To Form3.DataGridView3.Rows.Count - 2
                               For j = Form3.DataGridView3.Rows.Count - 1 To i + 1 Step -1
                                   If Form3.DataGridView3.Rows(i).ToString = Form3.DataGridView3.Rows(j).ToString Then
                                       Form3.DataGridView3.Rows.RemoveAt(j)
 



RE: طلب تعديل كود - aldery - 25-07-21

(25-07-21, 02:04 PM)إليسار كتب : مرحبا
ممكن احد يعدل لي ع هذا الكود الفكره اذاكانت البيانات في DataGridView1 = DataGridView2 يظهر لي اوك بس هنا المشكله ع طول يظهر لي كلمة ok
المشكله الثانية لا ينقل لي البيانات المختلفة لDataGridView3 ينقل لي البيانات المتشابه بس ويكررها 






كود :
       For Each r1 As DataGridViewRow In DataGridView1.Rows
           For Each r2 As DataGridViewRow In DataGridView2.Rows
               If r1.Cells(0).Value = r2.Cells(0).Value Then
                   MsgBox("ok")

                   For indx As Integer = 2 To 5

                       Dim val1 As Double = r1.Cells(indx).Value
                       Dim val2 As Double = r2.Cells(indx).Value

                       If r1.Cells(0).Value <> r2.Cells(0).Value Then
                           Form3.DataGridView3.Rows.Add(r1.Cells(0).Value, r1.Cells(1).Value,
r1.Cells(2).Value, r1.Cells(3).Value, r1.Cells(4).Value, r1.Cells(5).Value)  
                       Else
                           Form3.DataGridView3.Rows.Add(r2.Cells(0).Value, r2.Cells(1).Value, r2.Cells(2).Value, r2.Cells(3).Value,
r2.Cells(4).Value, r2.Cells(5).Value)
                           Form3.Show()
For i = 0 To Form3.DataGridView3.Rows.Count - 2
                               For j = Form3.DataGridView3.Rows.Count - 1 To i + 1 Step -1
                                   If Form3.DataGridView3.Rows(i).ToString = Form3.DataGridView3.Rows(j).ToString Then
                                       Form3.DataGridView3.Rows.RemoveAt(j)
 

تفضل أخي هذا حسب ما فهمت منك


كود :
    For Each r1 As DataGridViewRow In DataGridView1.Rows
           For Each r2 As DataGridViewRow In DataGridView2.Rows
               If r1.Cells(+1).Value = r2.Cells(+1).Value Then
                   MsgBox("ok")

                   For indx As Integer = 2 To 5

                       Dim val1 As Double = r1.Cells(indx).Value
                       Dim val2 As Double = r2.Cells(indx).Value

                       If r1.Cells(0).Value <> r2.Cells(0).Value Then
                           Form3.DataGridView3.Rows.Add(r1.Cells(0).Value, r1.Cells(1).Value,
r1.Cells(2).Value, r1.Cells(3).Value, r1.Cells(4).Value, r1.Cells(5).Value)
                       Else
                           Form3.DataGridView3.Rows.Add(r2.Cells(0).Value, r2.Cells(1).Value, r2.Cells(2).Value, r2.Cells(3).Value,
r2.Cells(4).Value, r2.Cells(5).Value)
                           Form3.Show()
                           For i = 0 To Form3.DataGridView3.Rows.Count - 2
                               For j = Form3.DataGridView3.Rows.Count - 1 To i + 1 Step -1
                                   If Form3.DataGridView3.Rows(i).ToString = Form3.DataGridView3.Rows(j).ToString Then
                                       Form3.DataGridView3.Rows.RemoveA



RE: طلب تعديل كود - إليسار - 25-07-21

يعطيك العافية بس ما ضبط الكود 
لسى يعطينى الصفوف المتشابه انا ابغي الصفوف المختلفة يرسلها ل Datagridview3


RE: طلب تعديل كود - إليسار - 30-07-21

ممكن كود لنقل البيانات المختلفة ل Datagridview3