تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] طلب تعديل كود
#1
Star 
مرحبا
ممكن احد يعدل لي ع هذا الكود الفكره اذاكانت البيانات في 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)
 
الرد }}}
تم الشكر بواسطة:
#2
(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
الْحَمْدُ لِلَّهِ حَمْدًا كَثِيرًا طَيِّبًا مُبَارَكًا فِيهِ

رَبِّي أَرْزُقْنِي مُسْتَقْبَلاً أَجَمَلَ مِمَّا تَمَنَّيْتُ

وَاَجْعَل لِي فِيْ هَذِهِ الدُّنْيَا - أُنَاساً يَدْعُونَ لِي بَعْدَ أَنْ أَغِيْب

حسابي في تلكرام

الرد }}}
تم الشكر بواسطة: اسامه الهرماوي , ابراهيم ايبو
#3
يعطيك العافية بس ما ضبط الكود 
لسى يعطينى الصفوف المتشابه انا ابغي الصفوف المختلفة يرسلها ل Datagridview3
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو
#4
ممكن كود لنقل البيانات المختلفة ل Datagridview3
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  تعديل على فاتورة مبيعات خالد كامل1 4 67 26-03-24, 10:49 PM
آخر رد: خالد كامل1
  تعديل كود ارسال صورة الى الواتس new_programer 2 114 21-03-24, 10:07 PM
آخر رد: new_programer
  تعديل صب المجموع الكلي والمعدل والتقدير مصمم هاوي 3 130 19-03-24, 01:33 AM
آخر رد: مصمم هاوي
  تعديل طول حقل معين في جميع جداول القاعدة atefkhalf2004 1 97 09-03-24, 03:17 AM
آخر رد: atefkhalf2004
  تعديل بيانات عمود DataGridView دفعة واحدة مصمم هاوي 2 164 05-03-24, 08:27 PM
آخر رد: مصمم هاوي
  ممكن تعديل في كود التفقيط للارقام melad2002 2 333 01-01-24, 08:47 PM
آخر رد: melad2002
  [VB.NET] اريد تعديل في الكود عند طباعة DGV abu_hisham7 1 431 03-12-23, 02:40 AM
آخر رد: abu_hisham7
  [VB.NET] محتاج مساعدة تعديل على كود ZEEN4ZEEN 4 416 08-10-23, 09:11 PM
آخر رد: ZEEN4ZEEN
  محتاج تعديل على سورس كود - حفظ البيانات بدون قاعدة بيانات new_programer 5 628 30-08-23, 12:21 AM
آخر رد: atefkhalf2004
  اريد اضافة متغيراخر داخل Listbox1 احتاج تعديل بسيط moh61 0 349 05-08-23, 02:29 PM
آخر رد: moh61

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم