felischaus Posted January 3, 2014 Share Posted January 3, 2014 İyi günler arkadaşlar, benim sorunum şu ki VBA'da bir datagridview nesnesi üzerinde x sütunundaki elemanların karesini toplatmak istiyorum fakat ilk satırı bir türlü toplamıyor, toplamaya ikinci satırdan başlıyor; uyguladığım kod ve proje dosyası şöyle; Public Class Form1 Dim hata1, xkaretoplam As VariantType Private Sub DataGridView1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged n.Text = Val(DataGridView1.RowCount) - 1 xkare.Text = 0 For i = 1 To Val(DataGridView1.RowCount) - 1 xkaretoplam = Val(DataGridView1.Rows(i).Cells("X").Value()) ^ 2 xkare.Text = xkaretoplam + Val(xkare.Text) Next End Sub End Class proje dosyası; http://rapidshare.com/share/DC020A44B9B3187819636FC0D489C4FC Quote Link to comment Share on other sites More sharing options...
galetis Posted January 3, 2014 Share Posted January 3, 2014 For i = 1 To Val(DataGridView1.RowCount) - 1 satırını For i = 0 To Val(DataGridView1.RowCount) - 1 olarak değiştir Quote Link to comment Share on other sites More sharing options...
felischaus Posted January 3, 2014 Author Share Posted January 3, 2014 o zaman da resimdeki gibi bir hata veriyor; http://postimg.org/image/7wtum31wf/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.