Prevent add new rows

1 posts, 0 answers
  1. Hengky
    Hengky avatar
    43 posts
    Member since:
    Sep 2015

    Posted 21 May 2017 Link to this post

    Hello All.... 

    i have this code .. 

        Private Sub GridBarang_CellEndEdit(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles GridBarang.CellEndEdit
            If e.ColumnIndex = 0 Then
                If GridBarang.CurrentCell.Value = Nothing Then
                    MsgBox("test")
                Else
                    Dim strSQL As String
                    strSQL = Nothing
                    strSQL = "SELECT KodeBarang, NamaBarang FROM MstBarang WHERE KodeBarang='" & GridBarang.CurrentRow.Cells(0).Value.ToString & "' ORDER BY KodeBarang"

                    Using conn As New OleDbConnection(str)
                        conn.Open()
                        cmd = New OleDbCommand(strSQL, conn)
                        rd = cmd.ExecuteReader
                        rd.Read()

                        If Not rd.HasRows Then
                            MsgBox("Tidak ada kode tersebut ")

                        Else
                            With GridBarang
                                .CurrentCell.Value = rd.GetString(0)
                                .CurrentRow.Cells(1).Value = rd.GetString(1)
                            End With
                        End If

                        rd.Close()
                        conn.Close()
                    End Using
                End If
            End If
        End Sub

    How to prevent add new row when after inserting new data ... and go to column(3) after edited column(0)  

    Thanks before.... 

     

Back to Top