تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
المساعدة في إيجاد حل كود للجريدفيو مرفق مثال
#5
(05-03-18, 11:46 AM)Abu Ehab كتب : هذا  الكلاس فوورم  بالكامل   أنسخ والصق فقط 

كود :
Imports System.Data.OleDb
Public Class Form1
   Dim ConStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\db.accdb"
   Dim Conn As New OleDbConnection(ConStr)
   Dim da As New OleDbDataAdapter
   Dim dt As New DataTable
   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       dt.Clear()
       da = New OleDbDataAdapter("Select * from AAA", Conn)
       da.Fill(dt)
       DataGridView1.DataSource = dt
        DataGridView1.Columns(0).Visible = False


        Compute(DataGridView1)
    End Sub

    Private Sub B2DatesFind_Btn_Click(sender As Object, e As EventArgs) Handles B2DatesFind_Btn.Click
        Dim dtp1 As Date = DateTimePicker_from.Value
        Dim dtp2 As Date = DateTimePicker_to.Value
        dt.Clear()
        da = New OleDbDataAdapter("Select * from AAA where Date >= #" & dtp1.Year & "/" & dtp1.Month & "/" & dtp1.Day & "# and Date <= #" & dtp2.Year & "/" & dtp2.Month & "/" & dtp2.Day & "# order by Date ", Conn)
        da.Fill(dt)
        DataGridView1.DataSource = dt
        Conn.Close()

        TextBox1.Text = (From row In DataGridView1.Rows Select CDbl(row.Cells(2).Value)).Sum()
    End Sub






    Private Sub Compute(ByVal Dgv As DataGridView)

        Dgv.Rows(Dgv.Rows.Count - 1).Cells(1).Value = "Total Is "
        Dgv.Rows(Dgv.Rows.Count - 1).Cells(1).Style.BackColor = Color.Black
        Dgv.Rows(Dgv.Rows.Count - 1).Cells(1).Style.ForeColor = Color.Gold

        Dim rw1 = From theRow As DataGridViewRow In Dgv.Rows
                  Where theRow.Cells(2).FormattedValue <> String.Empty
                  Select theRow


        Dgv.Rows(Dgv.Rows.Count - 1).Cells(2).Value = rw1.Sum(Function(x As DataGridViewRow) x.Cells(2).Value)


        Dim rw2 = From theRow As DataGridViewRow In Dgv.Rows
                  Where theRow.Cells(3).FormattedValue <> String.Empty
                  Select theRow


        Dgv.Rows(Dgv.Rows.Count - 1).Cells(3).Value = rw2.Sum(Function(x As DataGridViewRow) x.Cells(3).Value)


        Dim rw3 = From theRow As DataGridViewRow In Dgv.Rows
                  Where theRow.Cells(4).FormattedValue <> String.Empty
                  Select theRow


        Dgv.Rows(Dgv.Rows.Count - 1).Cells(4).Value = rw3.Sum(Function(x As DataGridViewRow) x.Cells(4).Value)

    End Sub

End Class

السلام عليكم 
مشكور أخي ابو ايهاب وجزاك الله الف خير كود الجمع شغال تمام  بس ممكن تطويره
ليشمل جميع الاعمدة الموجودة حتي لا يتم تكرار الكود لان يوجد لدي عدة أعمدة 

ولك من جزيل الشكر والعرفان

PHP كود :
Dim rw1 From theRow As DataGridViewRow In Dgv.Rows
                  Where theRow
.Cells(2).FormattedValue <> String.Empty
 
                 Select theRow

        Dgv
.Rows(Dgv.Rows.Count 1).Cells(2).Value rw1.Sum(Function(As DataGridViewRowx.Cells(2).Value
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: المساعدة في إيجاد حل كود للجريدفيو مرفق مثال - بواسطة بيسك لكل العرب - 05-03-18, 07:23 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [سؤال] يوجد مثال|كيف نعيد صياغة نص ليكون تاريخ مقبول justforit 7 301 01-11-25, 10:54 PM
آخر رد: justforit
  [VB.NET] مثال و مشكلة (تشفير نص) mmaalmesry 5 898 09-05-25, 08:05 AM
آخر رد: mmaalmesry
  ارجو تعديل الكود جلب البيانات عن طريق اجراء مخزن - مرفق مثال new_programer 0 620 05-02-25, 01:51 AM
آخر رد: new_programer
  اريد جلب عدد محدد من السجلات من قاعدة بيانات اكسس الى الداتا قراد فيو يوجد مثال khalidalwdi 2 666 12-11-24, 12:19 PM
آخر رد: khalidalwdi
  ارجو المساعدة في فك تسفير ملف xml mimomassa17 0 213 15-09-24, 03:23 PM
آخر رد: mimomassa17
  ارجو المساعدة في كود مقارنة عامود داخل الداتا جريد فيو alachk 11 1,091 11-08-24, 11:44 AM
آخر رد: alachk
  المساعدة في عملية طرح الوقت من خلال اثنين textbox جيولوجي مبتدئ 9 2,760 06-08-24, 07:43 PM
آخر رد: خالد كامل1
  [VB.NET] ممكن المساعدة في اجراء بحث كومبوبكس وتيكست raedre22 20 1,122 18-07-24, 12:18 PM
آخر رد: raedre22
  اريد اضافة حفظ PDF فى مسار على الهارد- مثال الاستاذ عبدالله الدوسري new_programer 1 515 28-04-24, 04:52 PM
آخر رد: new_programer
  مرفق سورس كود ارسال ملفات الى الواتس بدون API new_programer 4 874 28-04-24, 06:31 AM
آخر رد: new_programer

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


يقوم بقرائة الموضوع: