تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
لو سمحتوا يا جماعه طلب جمع قيم خلايا عمود فى الداتا جريد فيو
#1
العمود الرابع لو بدانا من 0 -1-2-3-4 
جربت اكواد كتير بيكون الجمع 0 مع العلم ان فى قيم فى الخلايا
لو سمحتوا تعديل الكود

PHP كود :
 Private Sub folderadd_Load(sender As ObjectAs EventArgsHandles MyBase.Load


        Me
.txtid.Focus()
 
       For i 0 To dgvprodac.Columns.Count 1
            dgvprodac
.Columns(i).SortMode DataGridViewColumnSortMode.NotSortable

        Next
       
        
'For i = 0 To dt.Rows.Count - 1
        ' 
   dgvprodac.Rows(i).DefaultCellStyle.BackColor = If(i Mod 2 0Color.AliceBlueColor.AntiqueWhite)
 
       'Next
        '
Dim sum As Integer 0
        
'For i As Integer = 0 To dgvprodac.Rows.Count - 1
        ' 
   sum += Convert.ToInt32(dgvprodac.Rows(i).Cells(4).Value)
 
       'Next
        '
txttotal.Text sum.ToString()
 
       Dim Total As Integer 0As Integer 0
        While z 
dgvprodac.Rows.Count
            
'    sum += Convert.ToInt32(dgvprodac.Rows(i).Cells(4).Value)
            Total += CInt(dgvprodac.Rows(z).Cells(4).Value)
            z += 1
        End While
        txttotal.Text = Total.ToString()

        Dim da As New OleDb.OleDbDataAdapter("select label from tab_pro", con)
        Dim dt As New DataTable
        pd = Me.BindingContext(dt)
        da.Fill(dt)
        Dim itms = dt.Rows.Cast(Of DataRow).Select(Function(x) x("label").ToString).ToArray
        Dim gh As New AutoCompleteStringCollection()
        gh.AddRange(itms)
        txtlabel.AutoCompleteCustomSource = gh
        txtlabel.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        txtlabel.AutoCompleteSource = AutoCompleteSource.CustomSource
      

        txtsailman.Text = fullname
        sorse()
        

        
        Try
            con.Open()
            sqlstr = "Select IIF(MAX(Id) IS NULL,0,MAX(Id)) + 1 AS maxId from TAB_OLDER"
            '
sqlstr "select max ((MAX(Id) IS NULL,0,MAX(Id))) +1 from [tab_older] "
 
           cmd = New OleDbCommand(sqlstrcon)
 
           txtnamper.Text cmd.ExecuteScalar()
 
 
            con
.Close()
 
       Catch ex As Exception
            MessageBox
.Show(ex.Message)
 
       End Try
 
     
    End Sub 
الرد }}}
تم الشكر بواسطة:
#2
(19-06-17, 10:36 PM)نبيل كونكت كتب : العمود الرابع لو بدانا من 0 -1-2-3-4 
جربت اكواد كتير بيكون الجمع 0 مع العلم ان فى قيم فى الخلايا
لو سمحتوا تعديل الكود

PHP كود :
 Private Sub folderadd_Load(sender As ObjectAs EventArgsHandles MyBase.Load


        Me
.txtid.Focus()
 
       For i 0 To dgvprodac.Columns.Count 1
            dgvprodac
.Columns(i).SortMode DataGridViewColumnSortMode.NotSortable

        Next
       
        
'For i = 0 To dt.Rows.Count - 1
        ' 
   dgvprodac.Rows(i).DefaultCellStyle.BackColor = If(i Mod 2 0Color.AliceBlueColor.AntiqueWhite)
 
       'Next
        '
Dim sum As Integer 0
        
'For i As Integer = 0 To dgvprodac.Rows.Count - 1
        ' 
   sum += Convert.ToInt32(dgvprodac.Rows(i).Cells(4).Value)
 
       'Next
        '
txttotal.Text sum.ToString()
 
       Dim Total As Integer 0As Integer 0
        While z 
dgvprodac.Rows.Count
            
'    sum += Convert.ToInt32(dgvprodac.Rows(i).Cells(4).Value)
            Total += CInt(dgvprodac.Rows(z).Cells(4).Value)
            z += 1
        End While
        txttotal.Text = Total.ToString()

        Dim da As New OleDb.OleDbDataAdapter("select label from tab_pro", con)
        Dim dt As New DataTable
        pd = Me.BindingContext(dt)
        da.Fill(dt)
        Dim itms = dt.Rows.Cast(Of DataRow).Select(Function(x) x("label").ToString).ToArray
        Dim gh As New AutoCompleteStringCollection()
        gh.AddRange(itms)
        txtlabel.AutoCompleteCustomSource = gh
        txtlabel.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        txtlabel.AutoCompleteSource = AutoCompleteSource.CustomSource
      

        txtsailman.Text = fullname
        sorse()
        

        
        Try
            con.Open()
            sqlstr = "Select IIF(MAX(Id) IS NULL,0,MAX(Id)) + 1 AS maxId from TAB_OLDER"
            '
sqlstr "select max ((MAX(Id) IS NULL,0,MAX(Id))) +1 from [tab_older] "
 
           cmd = New OleDbCommand(sqlstrcon)
 
           txtnamper.Text cmd.ExecuteScalar()
 
 
            con
.Close()
 
       Catch ex As Exception
            MessageBox
.Show(ex.Message)
 
       End Try
 
     
    End Sub 

ما فهنت طلبك  بدك تجمع عمود بالداتا غريد ولا ماذا
                                                        Heart سبحان الله والحمد لله ولا اله الا الله والله اكبر  Heart
الرد }}}
تم الشكر بواسطة:
#3
(20-06-17, 12:44 AM)العواد الصغير كتب :
(19-06-17, 10:36 PM)نبيل كونكت كتب : العمود الرابع لو بدانا من 0 -1-2-3-4 
جربت اكواد كتير بيكون الجمع 0 مع العلم ان فى قيم فى الخلايا
لو سمحتوا تعديل الكود

PHP كود :
 Private Sub folderadd_Load(sender As ObjectAs EventArgsHandles MyBase.Load


        Me
.txtid.Focus()
 
       For i 0 To dgvprodac.Columns.Count 1
            dgvprodac
.Columns(i).SortMode DataGridViewColumnSortMode.NotSortable

        Next
       
        
'For i = 0 To dt.Rows.Count - 1
        ' 
   dgvprodac.Rows(i).DefaultCellStyle.BackColor = If(i Mod 2 0Color.AliceBlueColor.AntiqueWhite)
 
       'Next
        '
Dim sum As Integer 0
        
'For i As Integer = 0 To dgvprodac.Rows.Count - 1
        ' 
   sum += Convert.ToInt32(dgvprodac.Rows(i).Cells(4).Value)
 
       'Next
        '
txttotal.Text sum.ToString()
 
       Dim Total As Integer 0As Integer 0
        While z 
dgvprodac.Rows.Count
            
'    sum += Convert.ToInt32(dgvprodac.Rows(i).Cells(4).Value)
            Total += CInt(dgvprodac.Rows(z).Cells(4).Value)
            z += 1
        End While
        txttotal.Text = Total.ToString()

        Dim da As New OleDb.OleDbDataAdapter("select label from tab_pro", con)
        Dim dt As New DataTable
        pd = Me.BindingContext(dt)
        da.Fill(dt)
        Dim itms = dt.Rows.Cast(Of DataRow).Select(Function(x) x("label").ToString).ToArray
        Dim gh As New AutoCompleteStringCollection()
        gh.AddRange(itms)
        txtlabel.AutoCompleteCustomSource = gh
        txtlabel.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        txtlabel.AutoCompleteSource = AutoCompleteSource.CustomSource
      

        txtsailman.Text = fullname
        sorse()
        

        
        Try
            con.Open()
            sqlstr = "Select IIF(MAX(Id) IS NULL,0,MAX(Id)) + 1 AS maxId from TAB_OLDER"
            '
sqlstr "select max ((MAX(Id) IS NULL,0,MAX(Id))) +1 from [tab_older] "
 
           cmd = New OleDbCommand(sqlstrcon)
 
           txtnamper.Text cmd.ExecuteScalar()
 
 
            con
.Close()
 
       Catch ex As Exception
            MessageBox
.Show(ex.Message)
 
       End Try
 
     
    End Sub 

ما فهنت طلبك  بدك تجمع عمود بالداتا غريد ولا ماذا
اه بالظبط عايز اجمع العمود الرابع فى الداتا فريد فيو
الرد }}}
تم الشكر بواسطة:
#4
العمود الرابع ترتيبه 3


كود :
TextBox1.Text = (From row In DataGridView1.Rows Select CDbl(row.Cells(3).Value)).Sum()
الرد }}}
تم الشكر بواسطة: نبيل كونكت , نبيل كونكت
#5
الى الان ما فهمت ماذا تريد 
ولكن من اجل جمع عمود  مرر هذا الكود للداتا غريد مع مراعاة رقم الحقل والقيمة الفارغة والتكست وقد اخذتها 
من هذا المنتدى 
كود :
Public Sub sumcolimdatagridview(ByVal dvg As DataGridView, ByVal txtsum As TextBox, ByVal Col As String, ByVal Col1 As String) 'جمع عمود بالداتا غريد
       'اجراء جمع عمود بالداتا غريد فيو وياخذ اربعة معاملات
       'الاول الداتا غريد فيو
       'الثاني مربع نص من اجل الجمع
       'الثالث تحديد حقل الذا كان فارغا لا يتم جمع السجل الفارغ
       'الرابع الحقل المراد جمعه
       Try
           Dim sum As Decimal = 0 'تعريف متغير من نوع عملة
           For i As Integer = 0 To dvg.Rows.Count - 1 ' حلقة تكرار من اجل جمع كافة سجلات الحق المطلوب
               If Not dvg.Rows(i).Cells(Col).Value = Nothing Then
                   sum += Convert.ToDecimal(dvg.Rows(i).Cells(Col1).Value) 'عملية الجمع
               End If

           Next
           txtsum.Text = sum.ToString() 'اسناد قيمة المتغير للتكست بوكس
       Catch ex As Exception
           MsgBox("Can't load Web page" & vbCrLf & ex.Message)
       End Try

   End Sub
                                                        Heart سبحان الله والحمد لله ولا اله الا الله والله اكبر  Heart
الرد }}}
تم الشكر بواسطة: نبيل كونكت , نبيل كونكت
#6
(20-06-17, 04:02 PM)حريف برمجة كتب : العمود الرابع ترتيبه 3


كود :
TextBox1.Text = (From row In DataGridView1.Rows Select CDbl(row.Cells(3).Value)).Sum()

الله ينور يا بشمهندس
الرد }}}
تم الشكر بواسطة:
#7
تريد جمع  العمود رقم 4  الذي ترتيبه 3
                                                        Heart سبحان الله والحمد لله ولا اله الا الله والله اكبر  Heart
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  تلوين خلية واحدة فقط فى الداتا غريد اذا تغيرت القيمة ؟ a.amin 11 7,240 15-02-23, 02:13 PM
آخر رد: tighrmte
  جمع عمود في داتا جريد واظهار الناتج في تكست بوكس nabil 9 13,013 08-12-22, 01:27 PM
آخر رد: عبدالمؤمن
  تحويل multiline text الى single line في عمود في قاعدة بيانات sql server bassant 0 960 07-09-21, 04:36 PM
آخر رد: bassant
  اسناد عامود في قاعدة بيانات اكسيس الى عامود من نوع كومبوبوكس بالداتا جريد فيو بالفيجو Ghassanfff 2 2,124 08-01-21, 08:52 PM
آخر رد: سعود
  كود عدم تكرار البيانات بالداتا جريد فيو ِAbou Sama 4 7,592 04-12-20, 10:59 PM
آخر رد: Osama_NY
  مشكلة في إظهار عمود التاريخ في داتا جريد فيو mofhmy 5 6,564 12-11-20, 12:13 PM
آخر رد: bahaa.elkomy@yahoo.com
  [VB.NET] حفظ البيانات دفعة واحدة الداتا جريد فيو mahmoud.3com 2 3,266 19-12-19, 11:23 PM
آخر رد: بسام محمدغانم
  كود تصفير عمود في جدول اكسس samira20 1 2,491 31-03-19, 09:02 PM
آخر رد: بدري
  سوال بخصوص الداتا جريد Abdelrahman ala 7 3,095 07-03-19, 03:26 AM
آخر رد: Abdelrahman ala
Photo [VB.NET] تعديل المدخلات في (الداتا قريد فيو ) لفاتورة مبيعات؟ EYADISMAIL 1 2,561 09-01-19, 10:30 PM
آخر رد: EYADISMAIL

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


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