Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Gambas class file
- Public Sub _new()
- End
- Public Sub Form_Open()
- GridView1.mode = Select.Single
- definir()
- relleno()
- End
- Public Sub definir()
- With GridView1
- .header = 3
- .rows.count = 7
- .columns.count = 7
- .Columns[0].title = "Columna 1"
- .Columns[1].title = "Columna 2"
- .Columns[2].title = "Columna 3"
- .Columns[3].title = "Columna 4"
- .Columns[4].title = "Columna 5"
- .Columns[5].title = "Columna 6"
- .Columns[6].title = "Columna 7"
- .Columns[0].width = 50
- .Columns[1].width = 60
- .Columns[2].width = 60
- .Columns[3].width = 60
- .Columns[4].width = 60
- .Columns[5].width = 60
- .Columns[6].width = 118
- .font.name = "Times"
- .font.size = 9
- .Background = 16777215
- .Foreground = 0
- End With
- End
- Public Sub relleno()
- Dim a, b As Integer
- For a = 0 To GridView1.Rows.Max
- For b = 0 To GridView1.Columns.Max
- GridView1[a, b].text = Str$(a) & " " & Str$(b)
- Next
- Next
- End
- Public Sub GridView1_Click()
- Dim fila, columna As Integer
- 'aumentar fila
- GridView1.Rows.count += 1
- If GridView1.Rows.Selection.count = 0 Then
- Message.Info("Tienes que seleccionar una fila")
- Endif
- For fila = GridView1.Rows.Max To GridView1.Rows.Selection[0] Step -1
- For columna = 0 To GridView1.Columns.Max
- If fila - 1 > 0 Then GridView1[fila, columna].text = GridView1[fila - 1, columna].text
- Next
- Next
- 'elimino textos de la fila que acabo de añadir
- For columna = 0 To GridView1.Columns.Max
- GridView1[GridView1.Rows.Selection[0], columna].text = ""
- Next
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement