CLR: .Net / Mono / Boo / Otros CLR > VB .NET
Agregar Fila a un Datagridview
(1/1)
fm89-10:
Hola, necesito agregar una fila en un datagridview, al dar click derecho sobre el datagridview me aparezca un contexmenustrip y me diga que si quiero agregar una fila, el problema que tengo es que solo me agrega una fila pero si quiero seguir agregando filas no me las agrega.
Les dejo el codigo
--- Código: Text --- Private Sub DataGridView1_CellMouseDown_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDown If e.Button = Windows.Forms.MouseButtons.Right Then ContextMenuStrip1.Show(DataGridView1, New Point(e.X, e.Y)) End If End Sub Private Sub AgregarColumnaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AgregarColumnaToolStripMenuItem.Click Dim a As Integer = 1 Dim i As IntegerDim r as integer = 10 DataGridView1.RowCount = r + a For i = 1 To DataGridView1.RowCount DataGridView1.Rows(i - 1).Cells(1).Value = "" Next End If a += a End Sub
Espero su ayuda, gracias de antemano
Navegación
Ir a la versión completa