Results 1 to 2 of 2

Thread: Losing data in Datagridview

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2017
    Posts
    19

    Losing data in Datagridview

    I am trying to develope a project that has two dagaridviews, one combobox and button (picture below).
    When I click the button some column's data must be transported to another datagridview's column. I made it using two Datasets in sql and it works. When I click the button data in firts 4 column goes in the other datagridview columns without any losing. But some data of the last column disappear as seen in the picture. Please help to solve this problem.



    Name:  borsa11.jpg
Views: 371
Size:  30.8 KB


    You see 3 datasets but I use two of them

    Code:
    Public Class hesap
        Private Sub Datahepsi_BindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles Datahepsi_BindingNavigatorSaveItem.Click
            Me.Validate()
            Me.Datahepsi_BindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.BORSA3DataSet)
    
        End Sub
    
        Private Sub hesap_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'TODO: Bu kod satırı 'BORSA3DataSet2.borsa11' tablosuna veri yükler. Bunu gerektiği şekilde taşıyabilir, veya kaldırabilirsiniz.
            Me.Borsa11TableAdapter.Fill(Me.BORSA3DataSet2.borsa11)
            'TODO: Bu kod satırı 'BORSA3DataSet1.borsa' tablosuna veri yükler. Bunu gerektiği şekilde taşıyabilir, veya kaldırabilirsiniz.
            Me.BorsaTableAdapter.Fill(Me.BORSA3DataSet1.borsa)
            'TODO: Bu kod satırı 'BORSA3DataSet._datahepsi_' tablosuna veri yükler. Bunu gerektiği şekilde taşıyabilir, veya kaldırabilirsiniz.
            Me.Datahepsi_TableAdapter.Fill(Me.BORSA3DataSet._datahepsi_)
    
        End Sub
    
        Private Sub btn_hesap_Click(sender As Object, e As EventArgs) Handles btn_hesap.Click
            Dim x As Integer
            Dim w As Integer
            Dim q As Integer
            Dim v As Integer
            Dim y As Integer
    
    
            If ComboBox1.Text = "AEFES" Then
                x = 0
                w = 1
                q = 2
                v = 3
                y = 4
                GoTo hesap
            ElseIf ComboBox1.Text = "AFYON" Then
                x = 5
                w = 6
                q = 7
                v = 8
                y = 9
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "AKBNK" Then
                x = 10
                w = 11
                q = 12
                v = 13
                y = 14
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "AKENR" Then
                x = 15
                w = 16
                q = 17
                v = 18
                y = 19
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "AKSA" Then
                x = 20
                w = 21
                q = 22
                v = 23
                y = 24
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "AKSEN" Then
                x = 25
                w = 26
                q = 27
                v = 28
                y = 29
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ALARK" Then
                x = 30
                w = 31
                q = 32
                v = 33
                y = 34
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ALBRK" Then
                x = 35
                w = 36
                q = 37
                v = 38
                y = 39
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ALGYO" Then
                x = 40
                w = 41
                q = 42
                v = 43
                y = 44
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ALKIM" Then
                x = 45
                w = 46
                q = 47
                v = 48
                y = 49
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ANACM" Then
                x = 50
                w = 51
                q = 52
                v = 53
                y = 54
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ARCLK" Then
                x = 55
                w = 56
                q = 57
                v = 58
                y = 59
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ASELS" Then
                x = 60
                w = 61
                q = 62
                v = 63
                y = 64
    
                GoTo hesap
            ElseIf ComboBox1.Text = "AYEN" Then
                x = 65
                w = 66
                q = 67
                v = 68
                y = 69
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "AYGAZ" Then
                x = 70
                w = 71
                q = 72
                v = 73
                y = 74
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "BAGFS" Then
                x = 75
                w = 76
                q = 77
                v = 78
                y = 79
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "BANVT" Then
                x = 80
                w = 81
                q = 82
                v = 83
                y = 84
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "BIMAS" Then
                x = 85
                w = 86
                q = 87
                v = 88
                y = 89
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "BIZIM" Then
                x = 90
                w = 91
                q = 92
                v = 93
                y = 94
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "BJKAS" Then
                x = 95
                w = 96
                q = 97
                v = 98
                y = 99
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "BRISA" Then
                x = 100
                w = 101
                q = 102
                v = 103
                y = 104
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "CCOLA" Then
                x = 105
                w = 106
                q = 107
                v = 108
                y = 109
    
    
            ElseIf ComboBox1.Text = "CEMTS" Then
                x = 110
                w = 111
                q = 112
                v = 113
                y = 114
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "CLEBI" Then
                x = 115
                w = 116
                q = 117
                v = 118
                y = 119
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "CRFSA" Then
                x = 120
                w = 121
                q = 122
                v = 123
                y = 124
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "DEVA" Then
                x = 125
                w = 126
                q = 127
                v = 128
                y = 129
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "DOAS" Then
                x = 130
                w = 131
                q = 132
                v = 133
                y = 134
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "DOCO" Then
                x = 135
                w = 136
                q = 137
                v = 138
                y = 139
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "DOHOL" Then
                x = 140
                w = 141
                q = 142
                v = 143
                y = 144
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ECILC" Then
                x = 145
                w = 146
                q = 147
                v = 148
                y = 149
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "EGEEN" Then
                x = 150
                w = 151
                q = 152
                v = 153
                y = 154
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "EKGYO" Then
                x = 155
                w = 156
                q = 157
                v = 158
                y = 159
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ENKAI" Then
                x = 160
                w = 161
                q = 162
                v = 163
                y = 164
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "ERBOS" Then
                x = 165
                w = 166
                q = 167
                v = 168
                y = 169
    
    
                GoTo hesap
            ElseIf ComboBox1.Text = "EREGL" Then
                x = 170
                w = 171
                q = 172
                v = 173
                y = 174
    
    
    
    
    hesap:
                Dim ac As Integer
                Dim ey As Integer
                Dim ed As Integer
                Dim ka As Integer
                Dim ha As Integer
    
    
    
                Dim ac1 As Integer
                Dim ey1 As Integer
                Dim ed1 As Integer
                Dim ka1 As Integer
                Dim ha1 As Integer
    
    
                ac = 0
                ey = 0
                ed = 0
                ka = 0
                ha = 0
    
    
                ac1 = 0
                ey1 = 0
                ed1 = 0
                ka1 = 0
                ha1 = 0
    
    
    
                For ac = 0 To 119
                    For ey = 0 To 119
                        For ed = 0 To 119
                            For ka = 0 To 119
                                For ha = 0 To 119
    
    
                                    For ac1 = 0 To 119
                                        For ey1 = 0 To 119
                                            For ed1 = 0 To 119
                                                For ka1 = 0 To 119
                                                    For ha1 = 0 To 119
    
    
    
    
    
                                                        Borsa11DataGridView.Rows(ac).Cells(0).Value = Datahepsi_DataGridView.Rows(ac1).Cells(x).Value
                                                        Borsa11DataGridView.Rows(ey).Cells(1).Value = Datahepsi_DataGridView.Rows(ey1).Cells(w).Value
                                                        Borsa11DataGridView.Rows(ed).Cells(2).Value = Datahepsi_DataGridView.Rows(ed1).Cells(q).Value
                                                        Borsa11DataGridView.Rows(ka).Cells(3).Value = Datahepsi_DataGridView.Rows(ka1).Cells(v).Value
                                                        Borsa11DataGridView.Rows(ha).Cells(4).Value = Datahepsi_DataGridView.Rows(ha1).Cells(y).Value
    
    
    
    
                                                        ac = ac + 1
                                                        ey = ey + 1
                                                        ed = ed + 1
                                                        ka = ka + 1
                                                        ha = ha + 1
    
    
                                                        ac1 = ac1 + 1
                                                        ey1 = ey1 + 1
                                                        ed1 = ed1 + 1
                                                        ka1 = ka1 + 1
                                                        ha1 = ha1 + 1
    
                                                    Next
                                                Next
                                            Next
                                        Next
                                    Next
                                Next
                            Next
                        Next
                    Next
                Next
    
    
            End If
    
    
        End Sub
    
    
    End Class
    Last edited by curiousman; Jun 21st, 2017 at 07:15 AM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    May 2017
    Posts
    19

    Re: Losing data in Datagridview

    ac = ac + 1
    ey = ey + 1
    ed = ed + 1
    ka = ka + 1
    ha = ha + 1


    ac1 = ac1 + 1
    ey1 = ey1 + 1
    ed1 = ed1 + 1
    ka1 = ka1 + 1
    ha1 = ha1 + 0

    I have made the code like this and mistake has been fixed.
    Thanks everbody.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width